Browse Source

chore: update GitHub Actions workflows to use latest action versions and streamline release process

- Upgraded checkout action from v3 to v4 in both auto-tag.yml and release.yml for improved performance.
- Updated setup-go action from v4 to v5 and goreleaser action from v4 to v5 to leverage the latest features.
- Changed the release job to inherit secrets instead of explicitly defining them, enhancing security.
- Added environment specification for the goreleaser job and refined the conditional execution for the release process.
pull/122/head
煎饼果子卷鲨鱼辣椒 5 months ago
parent
commit
f440f47e57
  1. 9
      .github/workflows/auto-tag.yml
  2. 14
      .github/workflows/release.yml

9
.github/workflows/auto-tag.yml

@ -18,7 +18,7 @@ jobs:
outputs: outputs:
new_tag: ${{ steps.get_latest_tag.outputs.version }} new_tag: ${{ steps.get_latest_tag.outputs.version }}
steps: steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
@ -50,10 +50,7 @@ jobs:
release: release:
needs: auto-tag needs: auto-tag
if: success() if: success()
uses: ./.github/workflows/release.yml
uses: ./.github/workflows/release.yml@${{ github.sha }}
with: with:
version: ${{ needs.auto-tag.outputs.new_tag }} version: ${{ needs.auto-tag.outputs.new_tag }}
secrets:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
secrets: inherit

14
.github/workflows/release.yml

@ -10,10 +10,13 @@ on:
secrets: secrets:
RELEASE_TOKEN: RELEASE_TOKEN:
required: true required: true
description: "GitHub token for release"
GPG_PRIVATE_KEY: GPG_PRIVATE_KEY:
required: true required: true
description: "GPG private key for signing"
PASSPHRASE: PASSPHRASE:
required: true required: true
description: "Passphrase for GPG key"
push: push:
tags: tags:
- "v*" - "v*"
@ -22,24 +25,25 @@ permissions: write-all
jobs: jobs:
goreleaser: goreleaser:
environment: production
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
lfs: true lfs: true
submodules: recursive submodules: recursive
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with: with:
go-version: "1.21" go-version: "1.21"
cache: true cache: true
- name: Import GPG key - name: Import GPG key
id: import_gpg id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
uses: crazy-max/ghaction-import-gpg@v6
with: with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }} passphrase: ${{ secrets.PASSPHRASE }}
@ -49,7 +53,7 @@ jobs:
git_tag_gpgsign: true git_tag_gpgsign: true
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with: with:
distribution: goreleaser distribution: goreleaser
version: latest version: latest
@ -58,3 +62,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
VERSION: ${{ inputs.version }} VERSION: ${{ inputs.version }}
if: github.event_name == 'workflow_call' || startsWith(github.ref, 'refs/tags/v')
Loading…
Cancel
Save