Skip to content

Commit fac6f06

Browse files
committed
add release automation
1 parent 53261d5 commit fac6f06

File tree

5 files changed

+82
-7
lines changed

5 files changed

+82
-7
lines changed

.goreleaser.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
checksum:
5+
disable: true
6+
snapshot:
7+
name_template: "SNAPSHOT-{{.ShortCommit}}"
8+
builds:
9+
- id: topframe
10+
goos:
11+
- darwin
12+
goarch:
13+
- amd64
14+
ldflags: "-X main.Version={{.Version}}"
15+
hooks:
16+
post: './scripts/gonutil {{.Version}}'
17+
archives:
18+
- id: default
19+
builds:
20+
- topframe
21+
name_template: '{{ .ProjectName }}_{{ .Version }}'
22+
format: zip
23+
files:
24+
- none*
25+
signs:
26+
- id: notarize
27+
signature: "${artifact}.zip"
28+
cmd: gon
29+
args: ["./dist/gon_notarize.json"]
30+
artifacts: all
31+
release:
32+
github:
33+
owner: progrium
34+
name: topframe
35+
ids:
36+
- default
37+
draft: true

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11

2-
build:
3-
go build -o local/topframe .
2+
build: local/bin/topframe
43

54
dev:
6-
go run ./topframe.go agent
5+
go run ./topframe.go
6+
7+
clean:
8+
rm -fr dist
9+
rm -f local/bin/topframe
10+
11+
release:
12+
git tag v$(version:dev=)
13+
git push origin v$(version:dev=)
14+
goreleaser release --rm-dist
15+
@echo "==> Remember to update ./version! Current contents: $(version)"
16+
17+
local/bin/topframe: topframe.go data/*
18+
go build -ldflags $(ldflags) -o local/bin/topframe .
19+
20+
version=$(shell cat version)
21+
branch=$(shell git branch --show-current)
22+
ldflags="-X main.Version=$(version:dev=$(branch))"

scripts/gonutil

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
cat <<CONFIG > ./dist/gon_sign.json
3+
{
4+
"source" : ["./dist/topframe_darwin_amd64/topframe"],
5+
"bundle_id" : "com.progrium.topframe",
6+
"sign" :{
7+
"application_identity" : "Developer ID Application: Jeff Lindsay"
8+
}
9+
}
10+
CONFIG
11+
gon -log-level=info -log-json ./dist/gon_sign.json > /dev/null
12+
cat <<CONFIG > ./dist/gon_notarize.json
13+
{
14+
"notarize": [{
15+
"path": "./dist/topframe_${1}.zip",
16+
"bundle_id": "com.progrium.topframe",
17+
"staple": false
18+
}]
19+
}
20+
CONFIG

topframe.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import (
2626
"github.com/progrium/watcher"
2727
)
2828

29-
const (
30-
version = "0.2.0"
29+
var (
30+
Version string
31+
3132
docsURL = "http://github.com/progrium/topframe"
3233
)
3334

@@ -54,7 +55,7 @@ func main() {
5455
return
5556
}
5657
if *flagVersion || *flagVersionShort {
57-
fmt.Println(version)
58+
fmt.Println(Version)
5859
return
5960
}
6061
if *flagDocs {
@@ -258,7 +259,7 @@ func runApp(dir string, addr *net.TCPAddr, fw *watcher.Watcher) {
258259
}()
259260
})
260261

261-
log.Printf("topframe %s from progrium.com\n", version)
262+
log.Printf("topframe %s from progrium.com\n", Version)
262263
app.ActivateIgnoringOtherApps(true)
263264
app.Run()
264265
}

version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.0dev

0 commit comments

Comments
 (0)