From 75ba7d668891868285687af79e8b8df4dd5070b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 15 Jul 2024 09:10:49 +0200 Subject: [PATCH] Automatically update versions using GitHub Actions --- .github/workflows/update.yml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..4e34b2d --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,47 @@ +name: Update + +on: + push: + branches: + - main + paths: + - '.github/**' + schedule: + - cron: "0 11 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + update: + name: Update Versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v5 + - name: Run update.sh. + run: ./update.sh + - name: Commit changes. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -x + + go install github.com/planetscale/ghcommit@latest + + if ! git diff --quiet daemon/Dockerfile; then + ghcommit -r ${{ github.repository }} \ + -b main \ + --add daemon/Dockerfile \ + --message "Update to tideways-daemon $(awk '$1 == "ENV" && $2 == "TIDEWAYS_DAEMON_VERSION"{print $3}' daemon/Dockerfile)" + fi + + if ! git diff --quiet php/Dockerfile; then + ghcommit -r ${{ github.repository }} \ + -b main \ + --add php/Dockerfile --add php/alpine/Dockerfile \ + --message "Update to tideways-php $(awk '$1 == "ENV" && $2 == "TIDEWAYS_PHP_VERSION"{print $3}' php/Dockerfile)" + fi