Browse Source

ci: improve workflow reliability and error handling

pull/85/head
dacrab 5 months ago
parent
commit
98537b94f9
  1. 8
      .github/workflows/auto-tag.yml
  2. 9
      .github/workflows/release.yml

8
.github/workflows/auto-tag.yml

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

9
.github/workflows/release.yml

@ -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 }}
Loading…
Cancel
Save