Skip to content

Commit f2cb1ea

Browse files
chore(release): use goreleaser (#530)
1 parent dd6357e commit f2cb1ea

File tree

6 files changed

+106
-33
lines changed

6 files changed

+106
-33
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
#
12+
name: release
13+
on:
14+
push:
15+
tags:
16+
- 'v*'
17+
jobs:
18+
goreleaser:
19+
runs-on: ubuntu-latest
20+
steps:
21+
-
22+
name: Checkout
23+
uses: actions/checkout@v2
24+
-
25+
name: Unshallow
26+
run: git fetch --prune --unshallow
27+
-
28+
name: Set up Go
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: 1.14
32+
-
33+
name: Import GPG key
34+
id: import_gpg
35+
uses: paultyng/[email protected]
36+
env:
37+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
38+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
39+
-
40+
name: Run GoReleaser
41+
uses: goreleaser/goreleaser-action@v2
42+
with:
43+
version: latest
44+
args: release --rm-dist
45+
env:
46+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ website/vendor
3131
# Test exclusions
3232
!command/test-fixtures/**/*.tfstate
3333
!command/test-fixtures/**/.terraform/
34+
35+
# Local release artifacts
36+
dist/

.goreleaser.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
- go mod tidy
6+
builds:
7+
- env:
8+
# goreleaser does not work with CGO, it could also complicate
9+
# usage by users in CI/CD systems like Terraform Cloud where
10+
# they are unable to install libraries.
11+
- CGO_ENABLED=0
12+
mod_timestamp: '{{ .CommitTimestamp }}'
13+
flags:
14+
- -trimpath
15+
ldflags:
16+
- '-s -w -X github.com/scaleway/terraform-provider-scaleway/scaleway.version={{.Version}}'
17+
goos:
18+
- freebsd
19+
- windows
20+
- linux
21+
- darwin
22+
goarch:
23+
- amd64
24+
- '386'
25+
- arm
26+
- arm64
27+
ignore:
28+
- goos: darwin
29+
goarch: '386'
30+
binary: '{{ .ProjectName }}_v{{ .Version }}'
31+
archives:
32+
- format: zip
33+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
34+
checksum:
35+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
36+
algorithm: sha256
37+
signs:
38+
- artifacts: checksum
39+
args:
40+
# if you are using this is a GitHub action or some other automated pipeline, you
41+
# need to pass the batch flag to indicate its not interactive.
42+
- "--batch"
43+
- "--local-user"
44+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
45+
- "--output"
46+
- "${signature}"
47+
- "--detach-sign"
48+
- "${artifact}"
49+
release:
50+
# Manually examine the release before its live
51+
draft: true
52+
changelog:
53+
skip: false

GNUmakefile

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,7 @@ test-compile:
4949
go test -c $(TEST) $(TESTARGS)
5050

5151
website:
52-
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
53-
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), getting..."
54-
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
55-
cd $(GOPATH)/src/$(WEBSITE_REPO) && git submodule init ext/providers/$(PKG_NAME) && git submodule update
56-
endif
57-
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
52+
@echo "Use this site to preview markdown rendering: https://registry.terraform.io/tools/doc-preview"
5853

59-
website-test:
60-
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
61-
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), getting..."
62-
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
63-
cd $(GOPATH)/src/$(WEBSITE_REPO) && git submodule init ext/providers/$(PKG_NAME) && git submodule update
64-
endif
65-
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
66-
67-
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website website-test
54+
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website
6855

go.sum

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
181181
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
182182
github.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI=
183183
github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=
184-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200213152732-b653c349beac h1:vs95YNeV7miD26crLiLEpu2q5FB4cqsXLb0a6EY2Ypk=
185-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200213152732-b653c349beac/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
186-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200214142021-a3b13afba582 h1:MfmioAzGL4x0gm2Idmemmw244hrqZK/73c93+qW+D5Q=
187-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200214142021-a3b13afba582/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
188-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200218123949-d26e180da05a h1:wqOBg7qPWMNmdjjnxkNYjit32Zs5QwCMEuC+b+6C8cY=
189-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200218123949-d26e180da05a/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
190-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200219165633-cc8064e6b5f1 h1:b6crXNA/2wfG1Yon7ym+/NYrATzGuwYndjO4BfeISaY=
191-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200219165633-cc8064e6b5f1/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
192-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6 h1:C1/pvkxkGN/H03mDxLzItaceYJDBk1HdClgR15suAzI=
193-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200407075309-351601ab0ad3 h1:0RWvOIoHoAQCctiGlGSYrjamJaD2zIxInpEbcF9ygq8=
194-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200407075309-351601ab0ad3/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
195-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200421151545-c4338a1f64c9 h1:VExNGApruijWPXvqW/ns6wlNwxAFm/8F7KnknJn5pwc=
196-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200421151545-c4338a1f64c9/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
197-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200429095002-79646b01c7da h1:BU7+fhbZwWErJNToCQR3ofEy7PDl1NSPdOoE/oekkQw=
198-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200429095002-79646b01c7da/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
199-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200619102539-dc791f6baf8c h1:mOtIb2fYFzhoGuv0Lp9zy+1h4/Ujqc76iF5LULP8wZA=
200-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200619102539-dc791f6baf8c/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
201184
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200625143330-d3e0c6c20474 h1:IkOChjasZthcGbr7j/7+KDneeQb/dcwQp+GeHLpiXNE=
202185
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200625143330-d3e0c6c20474/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
203186
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=

scaleway/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package scaleway
22

3-
// version is a variable because we modify it in provider_test.go
3+
// version not a const because we modify it in provider_test.go
44
var version = "v1.16.0"

0 commit comments

Comments
 (0)