Skip to content

Commit 75cca70

Browse files
authored
Merge pull request #901 from gitlabhq/nagyv-patch-1
Fix the release process
2 parents c6da2e6 + 7eebf09 commit 75cca70

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed

.github/workflows/release.yml

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# This GitHub action can publish assets for release when a tag is created.
22
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
33
#
4-
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
4+
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
55
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
66
# secret. If you would rather own your own GPG handling, please fork this action
77
# or use an alternative one for key handling.
88
#
9-
# You will need to pass the `--batch` flag to `gpg` in your signing step
9+
# You will need to pass the `--batch` flag to `gpg` in your signing step
1010
# in `goreleaser` to indicate this is being used in a non-interactive mode.
1111
#
1212
name: release
@@ -24,30 +24,36 @@ jobs:
2424
# Read the .go-version file and output it for other jobs to use.
2525
- id: go-version
2626
run: echo "::set-output name=go-version::$(cat .go-version)"
27-
2827
goreleaser:
2928
runs-on: ubuntu-latest
3029
needs: [go-version]
3130
steps:
32-
- uses: actions/setup-go@v2
31+
-
32+
name: Checkout
33+
uses: actions/[email protected]
34+
-
35+
name: Unshallow
36+
run: git fetch --prune --unshallow
37+
-
38+
name: Set up Go
39+
uses: actions/setup-go@v2
3340
with:
3441
go-version: ${{ needs.go-version.outputs.go-version }}
35-
- uses: actions/checkout@v2
36-
- uses: actions/cache@v2
37-
with:
38-
path: ~/go/pkg/mod
39-
key: ${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum') }}-no-tools
40-
- name: Unshallow
41-
run: git fetch --prune --unshallow
42-
- uses: paultyng/[email protected]
42+
-
43+
name: Import GPG key
4344
id: import_gpg
45+
uses: hashicorp/[email protected]
4446
env:
47+
# These secrets will need to be configured for the repository:
4548
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
4649
PASSPHRASE: ${{ secrets.PASSPHRASE }}
47-
- uses: goreleaser/goreleaser-action@v2
50+
-
51+
name: Run GoReleaser
52+
uses: goreleaser/[email protected]
4853
with:
4954
version: latest
5055
args: release --rm-dist
5156
env:
5257
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
58+
# GitHub sets this automatically
5359
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
13
builds:
24
- env:
5+
# goreleaser does not work with CGO, it could also complicate
6+
# usage by users in CI/CD systems like Terraform Cloud where
7+
# they are unable to install libraries.
38
- CGO_ENABLED=0
49
mod_timestamp: '{{ .CommitTimestamp }}'
510
flags:
@@ -24,17 +29,28 @@ archives:
2429
- format: zip
2530
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
2631
checksum:
32+
extra_files:
33+
- glob: 'terraform-registry-manifest.json'
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
2735
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
2836
algorithm: sha256
2937
signs:
3038
- artifacts: checksum
3139
args:
40+
# if you are using this in a GitHub action or some other automated pipeline, you
41+
# need to pass the batch flag to indicate its not interactive.
3242
- "--batch"
3343
- "--local-user"
34-
- "{{ .Env.GPG_FINGERPRINT }}"
44+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
3545
- "--output"
3646
- "${signature}"
3747
- "--detach-sign"
3848
- "${artifact}"
49+
release:
50+
extra_files:
51+
- glob: 'terraform-registry-manifest.json'
52+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
53+
# If you want to manually examine the release before its live, uncomment this line:
54+
# draft: true
3955
changelog:
4056
skip: true

terraform-registry-manifest.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": 1,
3+
"metadata": {
4+
"protocol_versions": ["5.0"]
5+
}
6+
}

0 commit comments

Comments
 (0)