From 95e1173849e811316190d3355463013ee0a0b430 Mon Sep 17 00:00:00 2001 From: suyiiyii Date: Sun, 25 Aug 2024 19:37:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(github-actions):=20=E4=BD=BF=E7=94=A8y?= =?UTF-8?q?q-action=E6=9B=BF=E6=8D=A2=E7=9B=B4=E6=8E=A5wget=E5=92=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BE=9D=E8=B5=96=E5=9B=BE=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在docker-publish.yml中使用mikefarah/yq-action直接替换繁琐的wget和chmod命令,用于更新manifest。 -通过精确的路径监听在maven.yml中优化依赖图提交动作,以响应pom.xml和src/更改,提高效率。 --- .github/workflows/docker-publish.yml | 9 +++------ .github/workflows/maven.yml | 10 ++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 94aca32..6f3494f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -100,14 +100,11 @@ jobs: uses: actions/checkout@v4 with: ref: manifest - - name: Update manifest 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 + uses: mikefarah/yq@master + with: + cmd: yq eval '.image.tag = "${{ steps.meta.outputs.tags }}"' -i values.yaml - name: Git Auto Commit uses: stefanzweifel/git-auto-commit-action@v5.0.1 with: diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ee4c4c8..8d26158 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -11,8 +11,14 @@ name: Java CI with Maven on: push: branches: [ "main" ] + paths: + - 'pom.xml' + - 'src/**' pull_request: branches: [ "main" ] + paths: + - 'pom.xml' + - 'src/**' jobs: build: @@ -34,5 +40,5 @@ jobs: # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive -# - name: Update dependency graph -# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6