Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0fd081c

Browse files
author
Sébastien HOUZÉ
committedAug 20, 2019
chore: setup ci
1 parent 7c1b170 commit 0fd081c

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed
 

‎.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
on: release
2+
3+
name: Upload release assets
4+
jobs:
5+
uploadReleaseAssets:
6+
name: Upload release assets
7+
runs-on: ubuntu-latest
8+
steps:
9+
10+
- name: set up Go 1.12
11+
uses: actions/setup-go@v1
12+
with:
13+
go-version: 1.12
14+
id: go
15+
16+
- name: Check out code into the Go module directory
17+
uses: actions/checkout@v1
18+
19+
- name: Build artifacts
20+
env:
21+
GO_BUILD_OPTIONS: "-a -installsuffix cgo"
22+
GO_BUILD_LDFLAGS: "-s -w"
23+
CGO_ENABLED: 0
24+
GOARCH: amd64
25+
TAG_NAME: ${{ github.event.release.tag_name }}
26+
run: |
27+
BUILD_DATE=$(date "+%Y-%m-%d")
28+
BUILD_COMMIT_HASH=$(git rev-parse --short HEAD 2> /dev/null)
29+
GO_BUILD_LDFLAGS="${GO_BUILD_LDFLAGS}
30+
-X github.com/inextensodigital/github/cmd.version=${TAG_NAME}
31+
-X github.com/inextensodigital/github/cmd.buildDate=${BUILD_DATE}
32+
-X github.com/inextensodigital/github/cmd.commitHash=${BUILD_COMMIT_HASH}
33+
"
34+
35+
GOOS=linux
36+
NAME=github-${GOOS}-${GOARCH}
37+
go build ${GO_BUILD_OPTIONS} -ldflags "${GO_BUILD_LDFLAGS}" -o release/${NAME}
38+
shasum -a 256 release/"${NAME}" > "release/${NAME}.sha256"
39+
40+
GOOS=darwin
41+
NAME=github-${GOOS}-${GOARCH}
42+
CGO_ENABLED=1 go build ${GO_BUILD_OPTIONS} -ldflags "${GO_BUILD_LDFLAGS}" -o release/${NAME}
43+
shasum -a 256 release/"${NAME}" > "release/${NAME}.sha256"
44+
45+
GOOS=windows
46+
NAME=github-${GOOS}-${GOARCH}.exe
47+
go build ${GO_BUILD_OPTIONS} -ldflags "${GO_BUILD_LDFLAGS}" -o release/${NAME}
48+
shasum -a 256 release/"${NAME}" > "release/${NAME}.sha256"
49+
50+
./release/github-linux-amd64 version
51+
52+
- name: Install hub cli
53+
run: |
54+
curl -s https://api.github.com/repos/github/hub/releases/latest |
55+
jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url' |
56+
wget -qi - -O - | sudo tar xzpf - -C / --strip-components=1
57+
58+
- name: Upload artifacts
59+
env:
60+
TAG_NAME: ${{ github.event.release.tag_name }}
61+
run: |
62+
hub release edit
63+
-m ""
64+
-a ./release/github-linux-amd64
65+
-a ./release/github-linux-amd64.sha256
66+
-a ./release/github-darwin-amd64
67+
-a ./release/github-darwin-amd64.sha256
68+
-a ./release/github-windows-amd64.exe
69+
-a ./release/github-windows-amd64.exe.sha256
70+
${TAG_NAME}

‎.github/workflows/test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on: push
2+
3+
name: ci
4+
jobs:
5+
ci:
6+
name: ci
7+
runs-on: ubuntu-latest
8+
steps:
9+
10+
- name: set up Go 1.12
11+
uses: actions/setup-go@v1
12+
with:
13+
go-version: 1.12
14+
id: go
15+
16+
- name: Check out code into the Go module directory
17+
uses: actions/checkout@v1
18+
19+
- name: Test
20+
run: go test -v .

0 commit comments

Comments
 (0)
Please sign in to comment.