Skip to content

Commit d70190b

Browse files
committed
github actions and updates to goreleaser config
1 parent ed1c4cb commit d70190b

File tree

4 files changed

+105
-18
lines changed

4 files changed

+105
-18
lines changed

.github/workflows/main.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Unshallow
18+
run: git fetch --prune --unshallow
19+
- name: Set up Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: 1.14
23+
- name: Test
24+
run: go test ./...
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v2
27+
with:
28+
version: latest
29+
args: release --rm-dist --skip-publish --snapshot
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Unshallow
15+
run: git fetch --prune --unshallow
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.14
20+
- name: Test
21+
run: go test ./...
22+
- name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v2
24+
with:
25+
version: latest
26+
args: release --rm-dist
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
*.out
1313

1414
/dist
15+
vendor/*
16+
17+
terraform-provider-rdsdataservice

.goreleaser.yml

+43-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,53 @@
1-
# This is an example goreleaser.yaml file with some sane defaults.
2-
# Make sure to check the documentation at http://goreleaser.com
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
33
before:
44
hooks:
5-
# you may remove this if you don't use vgo
6-
- go mod tidy
7-
# you may remove this if you don't need go generate
5+
- go mod download
86
- go generate ./...
97
builds:
10-
- env:
11-
- CGO_ENABLED=0
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 main.version={{.Version}} -X main.commit={{.Commit}}"
18+
goos:
19+
- linux
20+
- darwin
21+
goarch:
22+
- amd64
23+
ignore:
24+
- goos: darwin
25+
goarch: "386"
26+
binary: "{{ .ProjectName }}_v{{ .Version }}"
1227
archives:
13-
- replacements:
14-
darwin: Darwin
15-
linux: Linux
16-
windows: Windows
17-
386: i386
18-
amd64: x86_64
28+
- format: zip
29+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
1930
checksum:
20-
name_template: 'checksums.txt'
21-
snapshot:
22-
name_template: "{{ .Tag }}-next"
31+
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
32+
algorithm: sha256
33+
signs:
34+
- artifacts: checksum
35+
args:
36+
# if you are using this is a GitHub action or some other automated pipeline, you
37+
# need to pass the batch flag to indicate its not interactive.
38+
- "--batch"
39+
- "--local-user"
40+
- "--output"
41+
- "${signature}"
42+
- "--detach-sign"
43+
- "${artifact}"
44+
release:
45+
prerelease: auto
46+
# If you want to manually examine the release before its live, uncomment this line:
47+
# draft: true
2348
changelog:
2449
sort: asc
2550
filters:
2651
exclude:
27-
- '^docs:'
28-
- '^test:'
52+
- "^docs:"
53+
- "^test:"

0 commit comments

Comments
 (0)