File tree 9 files changed +61
-36
lines changed
9 files changed +61
-36
lines changed Original file line number Diff line number Diff line change
1
+ on :
2
+ push :
3
+ tags :
4
+ - ' v*'
5
+
6
+ name : Build and Release
7
+
8
+ jobs :
9
+
10
+ release :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+
14
+ - name : Checkout
15
+ uses : actions/checkout@master
16
+
17
+ - name : Build
18
+ uses :
audibleblink/[email protected]
19
+ with :
20
+ args : make release
21
+
22
+ - name : Get the version
23
+ id : get_version
24
+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
25
+
26
+ - name : Create Release
27
+ id : create_release
28
+ uses : actions/create-release@v1
29
+ env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31
+ with :
32
+ tag_name : ${{ steps.get_version.outputs.VERSION }}
33
+ release_name : Release ${{ steps.get_version.outputs.VERSION }}
34
+ draft : false
35
+ prerelease : false
36
+
37
+ - name : Upload Linux Release Asset
38
+ uses : actions/upload-release-asset@v1
39
+ env :
40
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
41
+ with :
42
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
43
+ asset_path : ./release.tar.gz
44
+ asset_name : amnesia.tar.gz
45
+ asset_content_type : application/gzip
46
+
Original file line number Diff line number Diff line change
1
+ bin
Original file line number Diff line number Diff line change 1
- .PHONY : windows linux darwin
1
+ .PHONY : all clean release
2
2
3
- FLAGS=-ldflags ="-s -w -buildid=" -trimpath
4
- BUILD =go build -a
5
- OUT =bin
3
+ APP =amnesia
4
+ OUT =release
5
+ FLAGS =-trimpath -ldflags="-s -w -buildid="
6
6
7
- all : windows windows32 linux linux32 linux-arm darwin
7
+ PLATFORMS = linux windows darwin
8
+ os = $(word 1, $@ )
8
9
9
- clean :
10
- rm -rf ${OUT}
11
-
12
- windows :
13
- $(eval GOOS=windows)
14
- $(eval GOARCH=amd64)
15
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH} .exe
16
-
17
- windows32 :
18
- $(eval GOOS=windows)
19
- $(eval GOARCH=386)
20
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH} .exe
21
-
22
- linux :
23
- $(eval GOOS=linux)
24
- $(eval GOARCH=amd64)
25
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH}
10
+ all : ${PLATFORMS}
26
11
27
- linux32 :
28
- $(eval GOOS=linux)
29
- $(eval GOARCH=386)
30
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH}
31
-
32
- linux-arm :
33
- $(eval export GOOS=linux)
34
- $(eval export GOARCH=arm64)
35
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH}
36
-
37
- darwin :
38
- $(eval GOOS=darwin)
39
- $(eval GOARCH=amd64)
40
- GOOS=${GOOS} GOARCH=${GOARCH} ${BUILD} ${FLAGS} -o ${OUT} /${GOOS} _${GOARCH} .macho
12
+ ${PLATFORMS} :
13
+ GOOS=${os} \
14
+ go build ${FLAGS} -o ${OUT} /${APP} -${os}
41
15
16
+ release : all
17
+ @tar -czvf ${OUT} .tar.gz ${OUT}
42
18
19
+ clean :
20
+ rm -rf ${OUT} *
You can’t perform that action at this time.
0 commit comments