Skip to content

Commit

Permalink
Run goreleaser action in snapshot mode from merge queue (#3646)
Browse files Browse the repository at this point in the history
* Run goreleaser action in snapshot mode from merge queue

* Don't run on PRs

* False branch
  • Loading branch information
pietern authored Jul 4, 2024
1 parent e864065 commit 701b5e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- '*'
merge_group:
types: [checks_requested]

jobs:
goreleaser:
Expand All @@ -19,21 +21,25 @@ jobs:
with:
go-version: 1.22.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 701b5e5

Please sign in to comment.