ci: improve workflow reliability and error handling

This commit is contained in:
dacrab 2024-12-27 13:05:04 +02:00
parent 17c2cb9c2a
commit 98537b94f9
2 changed files with 14 additions and 3 deletions

View File

@ -7,20 +7,20 @@ on:
- main - main
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- '.gitignore'
- '.github/workflows/**'
- 'LICENSE' - 'LICENSE'
- '.gitignore'
jobs: jobs:
auto-tag: auto-tag:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
outputs:
new_tag: ${{ steps.get_latest_tag.outputs.version }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest tag - name: Get latest tag
id: get_latest_tag id: get_latest_tag
@ -38,6 +38,8 @@ jobs:
fi fi
- name: Create new tag - name: Create new tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
new_tag=${{ steps.get_latest_tag.outputs.version }} new_tag=${{ steps.get_latest_tag.outputs.version }}
git config --global user.name 'github-actions[bot]' git config --global user.name 'github-actions[bot]'

View File

@ -24,6 +24,14 @@ jobs:
go-version: '1.21' go-version: '1.21'
cache: true 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 - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5 uses: goreleaser/goreleaser-action@v5
with: with:
@ -32,3 +40,4 @@ jobs:
args: release --clean args: release --clean
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}