Skip to content

Commit 7b59039

Browse files
Mihai BojinMihaiBojin
Mihai Bojin
authored andcommitted
nochangelog: [0.6.3 - re-release] Add goreleaser config for packaging and signing binaries (#275)
1 parent 047c87e commit 7b59039

File tree

6 files changed

+100
-82
lines changed

6 files changed

+100
-82
lines changed

.github/workflows/release.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
goreleaser:
8+
runs-on: ubuntu-latest
9+
steps:
10+
-
11+
name: Checkout
12+
uses: actions/checkout@v2
13+
-
14+
name: Unshallow
15+
run: git fetch --prune --unshallow
16+
-
17+
name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.14
21+
-
22+
name: Import GPG key
23+
id: import_gpg
24+
uses: paultyng/[email protected]
25+
env:
26+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
27+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
28+
- name: Set the user terminal
29+
run: export GPG_TTY=$(tty)
30+
-
31+
name: Run GoReleaser
32+
uses: goreleaser/goreleaser-action@v2
33+
with:
34+
version: latest
35+
args: release --rm-dist
36+
env:
37+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
6+
- go mod tidy
7+
builds:
8+
- env:
9+
# goreleaser does not work with CGO, it could also complicate
10+
# usage by users in CI/CD systems like Terraform Cloud where
11+
# they are unable to install libraries.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X mongodbatlas.ProviderVersion={{.Version}}'
18+
goos:
19+
- freebsd
20+
- windows
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- '386'
26+
- arm
27+
- arm64
28+
ignore:
29+
- goos: darwin
30+
goarch: '386'
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
32+
archives:
33+
- format: zip
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
35+
checksum:
36+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
37+
algorithm: sha256
38+
signs:
39+
- artifacts: checksum
40+
args:
41+
- "--batch"
42+
- "--local-user"
43+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
44+
- "--output"
45+
- "${signature}"
46+
- "--detach-sign"
47+
- "${artifact}"
48+
release:
49+
draft: true
50+
changelog:
51+
skip: false
52+
sort: asc
53+
filters:
54+
exclude:
55+
- '^nochangelog:'

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
github.com/Sectorbob/mlab-ns2 v0.0.0-20171030222938-d3aa0c295a8a
77
github.com/client9/misspell v0.3.4
88
github.com/go-test/deep v1.0.3
9-
github.com/golangci/golangci-lint v1.26.0
109
github.com/hashicorp/terraform-plugin-sdk v1.14.0
1110
github.com/mwielbut/pointy v1.1.0
1211
github.com/spf13/cast v1.3.1

0 commit comments

Comments
 (0)