Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run goreleaser action in snapshot mode from merge queue #3646

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' || '' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is github.ref's value when something is in the merge queue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like gh-readonly-queue/main/..., definitely not refs/tags/....

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
Loading