-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
81 lines (66 loc) · 2.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# `make version=0.1.0 tag`
version := 0.0.0-SNAPSHOT
author := Andrew Koltyakov
app := GitHub Notify
id := com.koltyakov.github-notify
install:
go get -u ./... && go mod tidy
which appify || go get github.com/machinebox/appify
which create-dmg || npm i -g create-dmg
which goreleaser || curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
format:
gofmt -s -w .
generate:
cd icon/ && ./gen.sh
make format
build-win:
GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w -X main.version=$(version) -H=windowsgui" -o bin/win/github-notify.exe ./
build-darwin:
GOOS=darwin GOARCH=amd64 go build -v -ldflags "-s -w -X main.version=$(version)" -o bin/darwin/github-notify ./
build-linux:
GOOS=linux GOARCH=amd64 go build -v -ldflags "-s -w -X main.version=$(version)" -o bin/linux/github-notify ./
build:
go build -v -o bin/github-notify ./
clean:
rm -rf bin/ dist/
bundle-darwin: build-darwin
# Package solution to .app folder
cd bin/darwin/ && \
appify \
-author "$(author)" \
-id $(id) \
-version $(version) \
-name "$(app)" \
-icon ../../assets/icon.png \
./github-notify
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' 'bin/darwin/$(app).app/Contents/Info.plist'
rm 'bin/darwin/$(app).app/Contents/README'
# Package solution to .dmg image
cd bin/darwin/ && \
create-dmg --dmg-title='$(app)' '$(app).app' ./ \
|| true # ignore Error 2
# Rename .dmg appropriately
mv 'bin/darwin/$(app) $(version).dmg' bin/darwin/github-notify_$(version)_darwin_x86_64.dmg
# Remove temp files
rm -rf 'bin/darwin/$(app).app'
bundle-linux:
docker build . -t github-notify
docker run -v $$PWD/bin:/build/bin -t github-notify make version=$(version) build-linux
tag:
git tag -a v$(version) -m "Version $(version)"
git push origin --tags
release-snapshot:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
./bin/goreleaser --rm-dist --skip-publish --snapshot
cd dist && ls *.dmg | xargs shasum -a256 >> $$(ls *_checksums.txt)
release:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
./bin/goreleaser --rm-dist --skip-publish
cd dist && ls *.dmg | xargs shasum -a256 >> $$(ls *_checksums.txt)
lint-cyclo:
which gocyclo || go get github.com/fzipp/gocyclo/cmd/gocyclo
gocyclo ./
start: run # alias for run
run:
pkill github-notify || true
nohup go run ./ >/dev/null 2>&1 &