Skip to content

Commit d40f036

Browse files
authored
Merge pull request #682 from ovh/dev/aamstutz/fix-release
fix: Release workflow + goreleaser
2 parents 313b2f8 + 029a687 commit d40f036

File tree

3 files changed

+33
-45
lines changed

3 files changed

+33
-45
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
1-
# This GitHub action can publish assets for release when a tag is created.
2-
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3-
#
4-
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
5-
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6-
# secret. If you would rather own your own GPG handling, please fork this action
7-
# or use an alternative one for key handling.
8-
#
9-
# You will need to pass the `--batch` flag to `gpg` in your signing step
10-
# in `goreleaser` to indicate this is being used in a non-interactive mode.
11-
#
1+
2+
# Terraform Provider release workflow.
123
name: release
4+
5+
# This GitHub action creates a release when a tag that matches the pattern
6+
# "v*" (e.g. v0.1.0) is created.
137
on:
148
push:
159
tags:
1610
- 'v*'
17-
workflow_dispatch:
11+
12+
# Releases need permissions to read and write the repository contents.
13+
# GitHub considers creating releases and uploading assets as writing contents.
14+
permissions:
15+
contents: write
1816

1917
jobs:
2018
goreleaser:
21-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-latest
2220
steps:
23-
-
24-
name: Checkout
25-
uses: actions/checkout@v2
26-
-
27-
name: Unshallow
28-
run: git fetch --prune --unshallow
29-
-
30-
name: Set up Go
31-
uses: actions/setup-go@v2
21+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3222
with:
33-
go-version: '1.21'
34-
-
35-
name: Import GPG key
23+
# Allow goreleaser to access older tag information.
24+
fetch-depth: 0
25+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
26+
with:
27+
go-version-file: 'go.mod'
28+
cache: true
29+
- name: Import GPG key
30+
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
3631
id: import_gpg
37-
uses: yanndegat/[email protected]
38-
env:
39-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
40-
PASSPHRASE: ${{ secrets.PASSPHRASE }}
41-
-
42-
name: Run GoReleaser
43-
uses: goreleaser/goreleaser-action@v2
4432
with:
45-
version: latest
33+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
34+
passphrase: ${{ secrets.PASSPHRASE }}
35+
- name: Run GoReleaser
36+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
37+
with:
4638
args: release --clean
4739
env:
48-
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
40+
# GitHub sets the GITHUB_TOKEN secret automatically.
4941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.goreleaser.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Visit https://goreleaser.com for documentation on how to customize this
22
# behavior.
3+
version: 2
34
before:
45
hooks:
56
# this is just an example and not a requirement for provider building/publishing
67
- go mod tidy
78
builds:
89
- env:
910
# goreleaser does not work with CGO, it could also complicate
10-
# usage by users in CI/CD systems like Terraform Cloud where
11+
# usage by users in CI/CD systems like HCP Terraform where
1112
# they are unable to install libraries.
1213
- CGO_ENABLED=0
1314
mod_timestamp: '{{ .CommitTimestamp }}'
@@ -28,8 +29,6 @@ builds:
2829
ignore:
2930
- goos: darwin
3031
goarch: '386'
31-
- goos: windows
32-
goarch: 'arm64'
3332
binary: '{{ .ProjectName }}_v{{ .Version }}'
3433
archives:
3534
- format: zip
@@ -40,21 +39,17 @@ checksum:
4039
signs:
4140
- artifacts: checksum
4241
args:
43-
# if you are using this is a GitHub action or some other automated pipeline, you
42+
# if you are using this in a GitHub action or some other automated pipeline, you
4443
# need to pass the batch flag to indicate its not interactive.
4544
- "--batch"
46-
- "--yes"
47-
- "--no-tty"
48-
- "--pinentry-mode"
49-
- "loopback"
5045
- "--local-user"
5146
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
5247
- "--output"
5348
- "${signature}"
5449
- "--detach-sign"
5550
- "${artifact}"
5651
release:
57-
# If you want to manually examine the release before its live, uncomment this line:
52+
# If you want to manually examine the release before its live, uncomment this line:
5853
# draft: true
5954
changelog:
60-
skip: true
55+
disable: true

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.46.0 (July 8, 2024)
1+
## 0.46.1 (July 8, 2024)
22

33
🎉 Features:
44

0 commit comments

Comments
 (0)