Skip to content

Commit

Permalink
ci(release): create goreleaser workflow that runs on tags (#137)
Browse files Browse the repository at this point in the history
The release please flow was creating a new release instead of publishing
the draft one. Since we are creating a tag with an app token, we could
listen for events on tag create

Add concurrency to test step since merging a change creates a new PR
pretty quickly and the main branch and release PR were interfering with
each other

Release-As: 2.2.2
  • Loading branch information
mloberg authored Oct 25, 2024
1 parent 481933e commit 38be960
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # pin@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- uses: goreleaser/goreleaser-action@v6
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
27 changes: 0 additions & 27 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,3 @@ jobs:
});
core.setOutput('sha', sha);
outputs:
released: ${{ steps.release.outputs.release_created }}
publish:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.released
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # pin@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- uses: goreleaser/goreleaser-action@v6
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
max-parallel: 1
matrix:
terraform: ${{ fromJSON(needs.versions.outputs.terraform) }}
concurrency:
group: test
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down

0 comments on commit 38be960

Please sign in to comment.