Skip to content

Commit 1bce89d

Browse files
authored
ci: add goreleaser (numtide#34)
1 parent 26018d0 commit 1bce89d

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

.github/workflows/goreleaser.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: goreleaser
2+
on: [ push ]
3+
jobs:
4+
goreleaser:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v2
9+
with:
10+
fetch-depth: 0
11+
- name: Set up Go
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.15
15+
- name: Import GPG key
16+
id: import_gpg
17+
uses: crazy-max/ghaction-import-gpg@v3
18+
with:
19+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
20+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
21+
- name: Run GoReleaser
22+
uses: goreleaser/goreleaser-action@v2
23+
with:
24+
version: "v0.144.0"
25+
args: release --rm-dist
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/nix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
name: numtide
1818
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
1919
- run: $(nix-build shell.nix) --pure /usr/bin/env HOME=$HOME golangci-lint run
20+
- run: nix-build -A devshell
2021
- run: nix flake check
2122
- run: nix develop -c echo OK
2223
- name: Run nix flake archive

.goreleaser.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
- go mod download
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
mod_timestamp: '{{ .CommitTimestamp }}'
10+
goos:
11+
- darwin
12+
- freebsd
13+
- linux
14+
goarch:
15+
- '386'
16+
- amd64
17+
- arm
18+
- arm64
19+
ignore:
20+
- goos: darwin
21+
goarch: '386'
22+
signs:
23+
- artifacts: checksum
24+
args:
25+
# if you are using this is a GitHub action or some other automated pipeline, you
26+
# need to pass the batch flag to indicate its not interactive.
27+
- "--batch"
28+
- "--local-user"
29+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
30+
- "--output"
31+
- "${signature}"
32+
- "--detach-sign"
33+
- "${artifact}"

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import (
66
"github.com/numtide/devshell/cmd"
77
)
88

9+
// These values are automatically set by `goreleaser` or can be set with
10+
// `go build -ldflags="-X main.version=something"` for example.
11+
var (
12+
// version = "dev"
13+
// commit = "unknown"
14+
// date = "unknown"
15+
// builtBy = "unknown"
16+
)
17+
918
func main() {
1019
err := cmd.Execute()
1120
if err != nil {

0 commit comments

Comments
 (0)