煎饼果子卷鲨鱼辣椒 01a932f3e5 chore: enhance GitHub Actions workflows with GPG key input for signing releases
- Added an optional input for GPG private key in release.yml to support signing releases.
- Updated the conditional check for GPG key import to utilize the new input, improving flexibility and maintainability.
- Ensured that the auto-tag workflow inherits secrets for better security practices.
2024-12-30 18:18:04 +08:00

57 lines
1.3 KiB
YAML

name: Release
on:
workflow_call:
inputs:
gpg_private_key:
description: "GPG private key to sign releases"
required: false
type: string
secrets:
RELEASE_TOKEN:
required: true
GPG_PRIVATE_KEY:
required: false
PASSPHRASE:
required: false
push:
tags:
- "v*"
permissions: write-all
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: true
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
if: inputs.gpg_private_key != ''
with:
gpg_private_key: ${{ inputs.gpg_private_key }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}