Skip to content

Update S6 Overlay

Update S6 Overlay #940

name: Update S6 Overlay
on:
push:
branches: main
paths: .github/workflows/update-s6-overlay.yml
schedule:
- cron: '0 15 * * 1-5'
workflow_dispatch:
permissions:
contents: read
concurrency: update-s6-overlay
jobs:
update-s6-overlay:
name: Update S6 Overlay
runs-on: ubuntu-latest
timeout-minutes: 5
env:
REGEX: ^(ARG S6_OVERLAY_VERSION=)[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(\-[0-9])?$
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
- name: Determine info
shell: bash
id: info
run: |
OLD_VERSION=$(
grep -oEi "$REGEX" Dockerfile |
grep -oEi '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(\-[0-9])?$'
)
API=https://api.github.com/repos/just-containers/s6-overlay/releases
RELEASES=https://github.com/just-containers/s6-overlay/releases
NEW_VERSION=$(curl -sSf "$API/latest" | jq -r .tag_name)
NEW_VERSION=${NEW_VERSION#'v'}
BUMP='Bump s6 overlay from'
UPDATE_TITLE="$BUMP $OLD_VERSION to $NEW_VERSION"
UPDATE_BODY="$BUMP"
UPDATE_BODY="$UPDATE_BODY [$OLD_VERSION]($RELEASES/v$OLD_VERSION)"
UPDATE_BODY="$UPDATE_BODY to [$NEW_VERSION]($RELEASES/v$NEW_VERSION)."
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "update-title=$UPDATE_TITLE" >> $GITHUB_OUTPUT
echo "update-body=$UPDATE_BODY" >> $GITHUB_OUTPUT
- name: Update Dockerfile
run: sed -i -E "s/$REGEX/\1$VERSION\2/" Dockerfile
env:
VERSION: ${{steps.info.outputs.version}}
- name: Handle changes
uses: peter-evans/create-pull-request@v6.0.5
id: changes
with:
token: ${{secrets.AUTOMATION_TOKEN}}
commit-message: ${{steps.info.outputs.update-title}}
committer: ${{env.GIT_USER}}
add-paths: Dockerfile
author: ${{env.GIT_USER}}
branch: auto/update-s6-overlay
delete-branch: true
title: ${{steps.info.outputs.update-title}}
body: ${{steps.info.outputs.update-body}}
labels: auto,dependencies
env:
GIT_USER: ${{secrets.AUTOMATION_USER}} <${{secrets.AUTOMATION_EMAIL}}>
- name: Enable auto-merge
if: steps.changes.outputs.pull-request-operation == 'created'
run: gh pr merge --auto --squash "$PULL_REQUEST_URL"
env:
PULL_REQUEST_URL: ${{steps.changes.outputs.pull-request-url}}
GITHUB_TOKEN: ${{secrets.AUTOMATION_TOKEN}}