chore: update GitHub Actions workflows to latest action versions and enhance release configuration

- Upgraded checkout action from v3 to v4 in both auto-tag.yml and release.yml for improved performance.
- Added optional input for GPG private key in release.yml to support signing releases.
- Updated setup-go action from v4 to v5 and goreleaser action from v4 to v5, ensuring compatibility with the latest features.
- Changed GoReleaser version specification to 'latest' for automatic updates.
This commit is contained in:
煎饼果子卷鲨鱼辣椒 2024-12-30 18:16:05 +08:00
parent e65c5f5fa8
commit a8765f85a7
2 changed files with 11 additions and 6 deletions

View File

@ -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

View File

@ -2,6 +2,11 @@ name: Release
on: on:
workflow_call: workflow_call:
inputs:
gpg_private_key:
description: "GPG private key to sign releases"
required: false
type: string
secrets: secrets:
RELEASE_TOKEN: RELEASE_TOKEN:
required: true required: true
@ -20,31 +25,31 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
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
if: "${{ secrets.GPG_PRIVATE_KEY != '' }}" if: "${{ secrets.GPG_PRIVATE_KEY != '' }}"
with: with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }} passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v5
with: with:
distribution: goreleaser distribution: goreleaser
version: v1.21.2 version: latest
args: release --clean args: release --clean
env: env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}