Skip to content

Commit

Permalink
add release automation
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Apr 15, 2021
1 parent 53261d5 commit fac6f06
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
before:
hooks:
- go mod tidy
checksum:
disable: true
snapshot:
name_template: "SNAPSHOT-{{.ShortCommit}}"
builds:
- id: topframe
goos:
- darwin
goarch:
- amd64
ldflags: "-X main.Version={{.Version}}"
hooks:
post: './scripts/gonutil {{.Version}}'
archives:
- id: default
builds:
- topframe
name_template: '{{ .ProjectName }}_{{ .Version }}'
format: zip
files:
- none*
signs:
- id: notarize
signature: "${artifact}.zip"
cmd: gon
args: ["./dist/gon_notarize.json"]
artifacts: all
release:
github:
owner: progrium
name: topframe
ids:
- default
draft: true
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@

build:
go build -o local/topframe .
build: local/bin/topframe

dev:
go run ./topframe.go agent
go run ./topframe.go

clean:
rm -fr dist
rm -f local/bin/topframe

release:
git tag v$(version:dev=)
git push origin v$(version:dev=)
goreleaser release --rm-dist
@echo "==> Remember to update ./version! Current contents: $(version)"

local/bin/topframe: topframe.go data/*
go build -ldflags $(ldflags) -o local/bin/topframe .

version=$(shell cat version)
branch=$(shell git branch --show-current)
ldflags="-X main.Version=$(version:dev=$(branch))"
20 changes: 20 additions & 0 deletions scripts/gonutil
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
cat <<CONFIG > ./dist/gon_sign.json
{
"source" : ["./dist/topframe_darwin_amd64/topframe"],
"bundle_id" : "com.progrium.topframe",
"sign" :{
"application_identity" : "Developer ID Application: Jeff Lindsay"
}
}
CONFIG
gon -log-level=info -log-json ./dist/gon_sign.json > /dev/null
cat <<CONFIG > ./dist/gon_notarize.json
{
"notarize": [{
"path": "./dist/topframe_${1}.zip",
"bundle_id": "com.progrium.topframe",
"staple": false
}]
}
CONFIG
9 changes: 5 additions & 4 deletions topframe.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ import (
"github.com/progrium/watcher"
)

const (
version = "0.2.0"
var (
Version string

docsURL = "http://github.com/progrium/topframe"
)

Expand All @@ -54,7 +55,7 @@ func main() {
return
}
if *flagVersion || *flagVersionShort {
fmt.Println(version)
fmt.Println(Version)
return
}
if *flagDocs {
Expand Down Expand Up @@ -258,7 +259,7 @@ func runApp(dir string, addr *net.TCPAddr, fw *watcher.Watcher) {
}()
})

log.Printf("topframe %s from progrium.com\n", version)
log.Printf("topframe %s from progrium.com\n", Version)
app.ActivateIgnoringOtherApps(true)
app.Run()
}
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.0dev

0 comments on commit fac6f06

Please sign in to comment.