From fc99e6b8ff0e0a2e1351fbffa4af94166b1dd640 Mon Sep 17 00:00:00 2001 From: pieter Date: Tue, 25 Nov 2025 10:33:46 +0000 Subject: [PATCH] =?UTF-8?q?.gitea/workflows/update-images.yaml=20=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/update-images.yaml | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .gitea/workflows/update-images.yaml diff --git a/.gitea/workflows/update-images.yaml b/.gitea/workflows/update-images.yaml new file mode 100644 index 0000000..731b553 --- /dev/null +++ b/.gitea/workflows/update-images.yaml @@ -0,0 +1,59 @@ +name: Update Docker Image Tags + +on: + schedule: + - cron: '0 2 * * 1' # 毎週月曜日午前2時 + workflow_dispatch: + +jobs: + update-tags: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Check for new nginx version + id: nginx + run: | + CURRENT=$(grep -A2 "nginx:" values.yaml | grep "tag:" | sed 's/.*tag: "\(.*\)"/\1/') + LATEST=$(curl -s https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=100 | \ + jq -r '.results[].name' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-alpine-perl$' | sort -V | tail -1) + echo "current=$CURRENT" >> $GITHUB_OUTPUT + echo "latest=$LATEST" >> $GITHUB_OUTPUT + + - name: Check for new wordpress version + id: wordpress + run: | + CURRENT=$(grep -A2 "wordpress:" values.yaml | grep "tag:" | sed 's/.*tag: "\(.*\)"/\1/') + LATEST=$(curl -s https://registry.hub.docker.com/v2/repositories/library/wordpress/tags?page_size=100 | \ + jq -r '.results[].name' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-php[0-9]+\.[0-9]+-fpm-alpine$' | sort -V | tail -1) + echo "current=$CURRENT" >> $GITHUB_OUTPUT + echo "latest=$LATEST" >> $GITHUB_OUTPUT + + - name: Update values.yaml + if: steps.nginx.outputs.current != steps.nginx.outputs.latest || steps.wordpress.outputs.current != steps.wordpress.outputs.latest + run: | + sed -i 's/tag: "${{ steps.nginx.outputs.current }}"/tag: "${{ steps.nginx.outputs.latest }}"/' values.yaml + sed -i 's/tag: "${{ steps.wordpress.outputs.current }}"/tag: "${{ steps.wordpress.outputs.latest }}"/' values.yaml + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: | + chore: update docker image tags + + - nginx: ${{ steps.nginx.outputs.current }} → ${{ steps.nginx.outputs.latest }} + - wordpress: ${{ steps.wordpress.outputs.current }} → ${{ steps.wordpress.outputs.latest }} + title: 'chore: update docker image tags' + body: | + ## Docker Image Updates + + | Image | Current | Latest | + |-------|---------|--------| + | nginx | `${{ steps.nginx.outputs.current }}` | `${{ steps.nginx.outputs.latest }}` | + | wordpress | `${{ steps.wordpress.outputs.current }}` | `${{ steps.wordpress.outputs.latest }}` | + + This PR was automatically generated. + branch: update-docker-images + delete-branch: true \ No newline at end of file