Skip to content

Commit

Permalink
Run goreleaser action in snapshot mode from merge queue
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Jun 5, 2024
1 parent 7d60ae7 commit e43ed13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
tags:
- '*'
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]

jobs:
goreleaser:
Expand All @@ -19,21 +23,25 @@ jobs:
with:
go-version: 1.21.x

# The default cache key for this action considers only the `go.sum` file.
# We include .goreleaser.yaml here to differentiate from the cache used by the push action
# that runs unit tests. This job produces and uses a different cache.
cache-dependency-path: |
go.sum
.goreleaser.yml
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v2
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}

- name: Pull external libraries
run: make vendor

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: ~> v2
args: release --clean
args: release --clean ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' }}
env:
# use GITHUB_TOKEN that is already available in secrets.GITHUB_TOKEN
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
Expand Down
11 changes: 10 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
version: 2

before:
hooks:
- go mod download

builds:
- env:
- CGO_ENABLED=0
Expand All @@ -15,18 +18,22 @@ builds:
goarch:
- amd64
- arm64

archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ replace .Version "v" "" }}_{{ .Os }}_{{ .Arch }}'
files:
- LICENSE*
- CHANGELOG*
- NOTICE*

checksum:
name_template: '{{ .ProjectName }}_{{ replace .Version "v" "" }}_SHA256SUMS'
algorithm: sha256

snapshot:
name_template: "{{ .Tag }}"

signs:
- artifacts: checksum
args:
Expand All @@ -36,11 +43,13 @@ signs:
- "${signature}"
- "--detach-sign"
- "${artifact}"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

release:
draft: true
draft: true

0 comments on commit e43ed13

Please sign in to comment.