Browse Source

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.
pull/122/head v0.0.21
煎饼果子卷鲨鱼辣椒 5 months ago
parent
commit
97e6e5165e
  1. 30
      .github/workflows/auto-tag-release.yml

30
.github/workflows/auto-tag-release.yml

@ -13,6 +13,17 @@ on:
- "**.md" - "**.md"
- "LICENSE" - "LICENSE"
- ".gitignore" - ".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: permissions:
contents: write contents: write
@ -130,7 +141,7 @@ jobs:
if: | if: |
(startsWith(github.ref, 'refs/tags/v') || (startsWith(github.ref, 'refs/tags/v') ||
(success() && steps.get_latest_tag.outputs.version != '')) && (success() && steps.get_latest_tag.outputs.version != '')) &&
secrets.GPG_PRIVATE_KEY != ''
!inputs.skip_signing
uses: crazy-max/ghaction-import-gpg@v5 uses: crazy-max/ghaction-import-gpg@v5
with: with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
@ -191,7 +202,7 @@ jobs:
if: | if: |
(startsWith(github.ref, 'refs/tags/v') || (startsWith(github.ref, 'refs/tags/v') ||
(success() && steps.get_latest_tag.outputs.version != '')) && (success() && steps.get_latest_tag.outputs.version != '')) &&
secrets.GPG_PRIVATE_KEY == ''
(inputs.skip_signing || steps.import_gpg.outcome == 'skipped')
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v4
with: with:
distribution: goreleaser distribution: goreleaser
@ -247,3 +258,18 @@ jobs:
if: failure() if: failure()
run: | run: |
echo "::error::Release process failed" 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
Loading…
Cancel
Save