From 97e6e5165e3b37eda773aff410e4eacde43dc67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=8E=E9=A5=BC=E6=9E=9C=E5=AD=90=E5=8D=B7=E9=B2=A8?= =?UTF-8?q?=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Mon, 30 Dec 2024 19:06:48 +0800 Subject: [PATCH] chore: enhance auto-tag workflow with GPG signing options and build summary - Added inputs for optional GPG private key and skip signing functionality to the workflow. - Updated conditions for GPG signing to allow skipping based on input parameters. - Introduced a new step to generate a build summary, detailing Go version, release version, GPG signing status, and build status, improving visibility into the release process. --- .github/workflows/auto-tag-release.yml | 30 ++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-tag-release.yml b/.github/workflows/auto-tag-release.yml index 4c9c7b1..e6a0803 100644 --- a/.github/workflows/auto-tag-release.yml +++ b/.github/workflows/auto-tag-release.yml @@ -13,6 +13,17 @@ on: - "**.md" - "LICENSE" - ".gitignore" + workflow_call: + inputs: + gpg_private_key: + required: false + type: string + description: "GPG private key for signing releases" + skip_signing: + required: false + type: boolean + default: false + description: "Skip GPG signing of releases" permissions: contents: write @@ -130,7 +141,7 @@ jobs: if: | (startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '')) && - secrets.GPG_PRIVATE_KEY != '' + !inputs.skip_signing uses: crazy-max/ghaction-import-gpg@v5 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} @@ -191,7 +202,7 @@ jobs: if: | (startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '')) && - secrets.GPG_PRIVATE_KEY == '' + (inputs.skip_signing || steps.import_gpg.outcome == 'skipped') uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser @@ -247,3 +258,18 @@ jobs: if: failure() run: | echo "::error::Release process failed" + + # 添加构建摘要步骤 + - name: Build Summary + if: always() + run: | + echo "## Build Summary" >> $GITHUB_STEP_SUMMARY + echo "- Go Version: $(go version)" >> $GITHUB_STEP_SUMMARY + echo "- Release Version: ${VERSION:-N/A}" >> $GITHUB_STEP_SUMMARY + echo "- GPG Signing: ${{ steps.import_gpg.outcome == 'success' && 'Enabled' || 'Disabled' }}" >> $GITHUB_STEP_SUMMARY + echo "- Build Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY + + if [ -d "dist" ]; then + echo "### Generated Artifacts" >> $GITHUB_STEP_SUMMARY + ls -lh dist/ | awk '{print "- "$9" ("$5")"}' >> $GITHUB_STEP_SUMMARY + fi