Skip to content

Commit

Permalink
fix: Improved build process (#191)
Browse files Browse the repository at this point in the history
This PR closes #190 by building binaries for all Hashicorp recommended platforms; and adds a SHASUMS file for compatibility with Terraform Registry.
  • Loading branch information
jmcvetta authored Dec 19, 2020
1 parent a8c5c86 commit 8387093
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 25 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ jobs:
name: Semantic Release
runs-on: ubuntu-18.04
steps:

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1

- name: Restore Node cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Setup Go
uses: actions/setup-go@v2

- name: Restore Go cache
uses: actions/cache@v2
with:
Expand All @@ -29,13 +34,24 @@ jobs:
~/.cache/go-build
# Blank version number means latest version of Go.
key: ${{ runner.os }}-go-v-${{ hashFiles('**/go.sum') }}

- name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true

- name: Install dependencies
run: npm ci

- name: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
run: npx semantic-release
67 changes: 42 additions & 25 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
#- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- openbsd
- linux
- freebsd
- darwin
- windows
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this is a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
skip: true

0 comments on commit 8387093

Please sign in to comment.