File tree Expand file tree Collapse file tree 3 files changed +44
-67
lines changed Expand file tree Collapse file tree 3 files changed +44
-67
lines changed Original file line number Diff line number Diff line change 1- name : Build
1+ name : Build and test
22on : [push]
33jobs :
4-
54 build :
6- name : Build
75 runs-on : ubuntu-latest
86 steps :
9-
10- - name : Set up Go 1.13
11- uses : actions/setup-go@v1
7+ - uses : actions/setup-go@v1
128 with :
139 go-version : 1.13
14- id : go
15-
16- - name : Check out code into the Go module directory
17- uses : actions/checkout@v2
18-
19- - name : Get dependencies
20- run : |
21- go get -v -t -d ./...
22- if [ -f Gopkg.toml ]; then
23- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
24- dep ensure
25- fi
26-
27- - name : Build
28- run : go build -v .
10+ - uses : actions/checkout@v2
11+ - run : make -j all
12+ - run : make -j test
Original file line number Diff line number Diff line change 1- name : Release
2- on : release
1+ name : Build and release
2+ on :
3+ release :
4+ types : [published]
35jobs :
4- release-linux-amd64 :
5- name : release linux/amd64
6+ build :
67 runs-on : ubuntu-latest
78 steps :
8- - uses : actions/checkout@master
9- - name : compile and release
10- 11- env :
12- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13- GOARCH : amd64
14- GOOS : linux
15- release-darwin-amd64 :
16- name : release darwin/amd64
17- runs-on : ubuntu-latest
18- steps :
19- - uses : actions/checkout@master
20- - name : compile and release
21- 22- env :
23- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
24- GOARCH : amd64
25- GOOS : darwin
26- release-windows-386 :
27- name : release windows/386
28- runs-on : ubuntu-latest
29- steps :
30- - uses : actions/checkout@master
31- - name : compile and release
32- 33- env :
34- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35- GOARCH : " 386"
36- GOOS : windows
37- release-windows-amd64 :
38- name : release windows/amd64
39- runs-on : ubuntu-latest
40- steps :
41- - uses : actions/checkout@master
42- - name : compile and release
43- 44- env :
45- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46- GOARCH : amd64
47- GOOS : windows
9+ - uses : actions/checkout@v2
10+ - uses : actions/setup-go@v1
11+ with :
12+ go-version : 1.13
13+ - run : make -j upload
14+ env :
15+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
16+ GITHUB_RELEASE_UPLOAD_URL : ${{ github.event.release.upload_url }}
Original file line number Diff line number Diff line change @@ -17,12 +17,36 @@ win64:
1717win32 :
1818 GOARCH=386 GOOS=windows $(GOBUILD ) -o $(BINDIR ) /$(NAME ) -$@ .exe
1919
20+
21+ test : test-linux test-macos test-win64 test-win32
22+
23+ test-linux :
24+ GOARCH=amd64 GOOS=linux go test
25+
26+ test-macos :
27+ GOARCH=amd64 GOOS=darwin go test
28+
29+ test-win64 :
30+ GOARCH=amd64 GOOS=windows go test
31+
32+ test-win32 :
33+ GOARCH=386 GOOS=windows go test
34+
2035releases : linux macos win64 win32
2136 chmod +x $(BINDIR ) /$(NAME ) -*
2237 gzip $(BINDIR ) /$(NAME ) -linux
2338 gzip $(BINDIR ) /$(NAME ) -macos
24- zip -m -j $(BINDIR ) /$(NAME ) -win64.zip $(BINDIR ) /$(NAME ) -win64.exe
2539 zip -m -j $(BINDIR ) /$(NAME ) -win32.zip $(BINDIR ) /$(NAME ) -win32.exe
40+ zip -m -j $(BINDIR ) /$(NAME ) -win64.zip $(BINDIR ) /$(NAME ) -win64.exe
2641
2742clean :
28- rm $(BINDIR ) /*
43+ rm $(BINDIR ) /*
44+
45+ # Remove trailing {} from the release upload url
46+ GITHUB_UPLOAD_URL =$(shell echo $${GITHUB_RELEASE_UPLOAD_URL% \{* })
47+
48+ upload : releases
49+ curl -H " Authorization: token $( GITHUB_TOKEN) " -H " Content-Type: application/gzip" --data-binary @$(BINDIR ) /$(NAME ) -linux.gz " $( GITHUB_UPLOAD_URL) ?name=$( NAME) -linux.gz"
50+ curl -H " Authorization: token $( GITHUB_TOKEN) " -H " Content-Type: application/gzip" --data-binary @$(BINDIR ) /$(NAME ) -macos.gz " $( GITHUB_UPLOAD_URL) ?name=$( NAME) -macos.gz"
51+ curl -H " Authorization: token $( GITHUB_TOKEN) " -H " Content-Type: application/zip" --data-binary @$(BINDIR ) /$(NAME ) -win64.zip " $( GITHUB_UPLOAD_URL) ?name=$( NAME) -win64.zip"
52+ curl -H " Authorization: token $( GITHUB_TOKEN) " -H " Content-Type: application/zip" --data-binary @$(BINDIR ) /$(NAME ) -win32.zip " $( GITHUB_UPLOAD_URL) ?name=$( NAME) -win32.zip"
You can’t perform that action at this time.
0 commit comments