From 98537b94f999f8c660e9b38e0c4a41619fd17176 Mon Sep 17 00:00:00 2001 From: dacrab Date: Fri, 27 Dec 2024 13:05:04 +0200 Subject: [PATCH] ci: improve workflow reliability and error handling --- .github/workflows/auto-tag.yml | 8 +++++--- .github/workflows/release.yml | 9 +++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index ddf3803..6411ac2 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -7,20 +7,20 @@ on: - main paths-ignore: - '**.md' - - '.gitignore' - - '.github/workflows/**' - 'LICENSE' + - '.gitignore' jobs: auto-tag: runs-on: ubuntu-latest permissions: contents: write + outputs: + new_tag: ${{ steps.get_latest_tag.outputs.version }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - name: Get latest tag id: get_latest_tag @@ -38,6 +38,8 @@ jobs: fi - name: Create new tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | new_tag=${{ steps.get_latest_tag.outputs.version }} git config --global user.name 'github-actions[bot]' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7576e0..5f907e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,14 @@ jobs: go-version: '1.21' cache: true + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + if: ${{ env.GPG_PRIVATE_KEY != '' }} + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: @@ -32,3 +40,4 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}