From 8a9612bcb3c6cf22fba03be386425af62f208c70 Mon Sep 17 00:00:00 2001 From: suyiiyii Date: Sun, 25 Aug 2024 19:32:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor(github-actions):=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=8F=90=E4=BA=A4=E9=95=9C=E5=83=8F=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=92=8CGitea=E5=90=8C=E6=AD=A5=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在docker-publish.yml中引入yq Linux二进制文件并设置权限,用于在'push'事件中自动更新部署镜像标签。 - 用git-auto-commit-action自动化提交更新到GitHub,使用机器用户凭据。- 在gitea-sync.yml中增加workflow_run事件的类型限定,仅在'Docker Build and Publish'工作流完成时触发。 --- .github/workflows/docker-publish.yml | 14 +++++++++++--- .github/workflows/gitea-sync.yml | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 19f725f..94aca32 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -105,7 +105,15 @@ jobs: if: github.event_name == 'push' run: | echo "Updating manifest" + wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq + chmod +x /usr/bin/yq yq eval '.image.tag = "${{ steps.meta.outputs.tags }}"' -i values.yaml - git add values.yaml - git commit -m "Update deployment image to ${{ steps.meta.outputs.tags }}" - git push + - name: Git Auto Commit + uses: stefanzweifel/git-auto-commit-action@v5.0.1 + with: + commit_message: "Update deployment image to ${{ steps.meta.outputs.tags }}" + branch: manifest + commit_user_name: "github-actions[bot]" + commit_user_email: "github-actions[bot]@users.noreply.github.com" + commit_author: "github-actions[bot] " + diff --git a/.github/workflows/gitea-sync.yml b/.github/workflows/gitea-sync.yml index 1c162a9..cc1c271 100644 --- a/.github/workflows/gitea-sync.yml +++ b/.github/workflows/gitea-sync.yml @@ -5,6 +5,8 @@ on: workflow_dispatch: workflow_run: workflows: ["Docker Build and Publish"] + types: + - completed jobs: