Skip to content

Commit

Permalink
chore: use goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiebens committed Feb 23, 2022
1 parent 4b7f5bc commit 47e6ba6
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ci-only

on:
push:
branches: [ master ]
branches: [ '*' ]
pull_request:
branches: [ master ]

Expand All @@ -25,4 +25,4 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- run: make dist
- run: go build
35 changes: 23 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
name: release

on:
release:
types: [ created ]
push:
tags:
- '*'

permissions:
contents: write
packages: write
id-token: write

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- name: Checkout
uses: actions/checkout@v2
with:
go-version: ^1.16
fetch-depth: 0

- uses: actions/checkout@v2.3.4
- name: Set up Go
uses: actions/setup-go@v2
with:
fetch-depth: 1
go-version: ^1.16

- run: make dist hash
- name: Install cosign
uses: sigstore/cosign-installer@v2.0.0

- uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: "./dist/*"
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
project_name: hashi-up

before:
hooks:
- go mod tidy

builds:
- id: default
env: [ CGO_ENABLED=0 ]
goos:
- linux
- windows
goarch:
- amd64
ldflags:
- -s -w -X github.com/jsiebens/hashi-up/cmd.Version={{.Version}} -X github.com/jsiebens/hashi-up/cmd.GitCommit={{.ShortCommit}}
- id: arm
env: [ CGO_ENABLED=0 ]
goos:
- linux
goarch:
- arm64
- arm
ldflags:
- -s -w -X github.com/jsiebens/hashi-up/cmd.Version={{.Version}} -X github.com/jsiebens/hashi-up/cmd.GitCommit={{.ShortCommit}}
- id: darwin
env: [ CGO_ENABLED=0 ]
goos:
- darwin
goarch:
- amd64
ldflags:
- -s -w -X github.com/jsiebens/hashi-up/cmd.Version={{.Version}} -X github.com/jsiebens/hashi-up/cmd.GitCommit={{.ShortCommit}}

archives:
- id: default
builds:
- default
format: binary
name_template: "{{ .ProjectName }}"
- id: darwin
builds:
- darwin
format: binary
name_template: "{{ .ProjectName }}-{{ .Os }}"
- id: arm
builds:
- arm
format: binary
name_template: "{{ .ProjectName }}-{{ .Arch }}{{ if .Arm }}hf{{ end }}"

checksum:
name_template: "checksums.txt"

signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
artifacts: checksum

0 comments on commit 47e6ba6

Please sign in to comment.