Skip to content

Commit a9546fb

Browse files
committed
use github actions to release prebuilt bins
1 parent 6790239 commit a9546fb

File tree

9 files changed

+61
-36
lines changed

9 files changed

+61
-36
lines changed

.github/workflows/main.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin

Makefile

+14-36
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,20 @@
1-
.PHONY: windows linux darwin
1+
.PHONY: all clean release
22

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="
66

7-
all: windows windows32 linux linux32 linux-arm darwin
7+
PLATFORMS = linux windows darwin
8+
os = $(word 1, $@)
89

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}
2611

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}
4115

16+
release: all
17+
@tar -czvf ${OUT}.tar.gz ${OUT}
4218

19+
clean:
20+
rm -rf ${OUT}*

bin/darwin_amd64.macho

-2.09 MB
Binary file not shown.

bin/linux_386

-1.65 MB
Binary file not shown.

bin/linux_amd64

-1.91 MB
Binary file not shown.

bin/linux_arm64

-1.94 MB
Binary file not shown.

bin/windows_386.exe

-1.76 MB
Binary file not shown.

bin/windows_amd64.exe

-2.06 MB
Binary file not shown.

0 commit comments

Comments
 (0)