Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit 0dd3381

Browse files
committed
ci: release workflow
1 parent 43f248d commit 0dd3381

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up Go 1.13
17+
uses: actions/setup-go@v1
18+
with:
19+
go-version: 1.13
20+
- name: Check out code into the Go module directory
21+
uses: actions/checkout@v2
22+
- name: Build
23+
run: go build -v -o bin/stackhead-cli
24+
25+
release:
26+
name: Release
27+
runs-on: ubuntu-latest
28+
needs: build
29+
env:
30+
GIT_AUTHOR_EMAIL: [email protected]
31+
GIT_AUTHOR_NAME: stackhead-bot
32+
GIT_COMMITTER_EMAIL: [email protected]
33+
GIT_COMMITTER_NAME: stackhead-bot
34+
steps:
35+
- uses: actions/setup-go@v2
36+
with:
37+
go-version: 1.15
38+
- run: |
39+
go get github.com/mitchellh/gox
40+
go get github.com/tcnksm/ghr
41+
- uses: actions/checkout@v2
42+
- uses: go-semantic-release/action@v1
43+
id: semrel
44+
with:
45+
github-token: ${{ secrets.GH_TOKEN }}
46+
ghr: true
47+
- run: |
48+
gox -parallel 4 -osarch="linux/amd64 darwin/amd64 linux/arm windows/amd64" -ldflags="-extldflags '-static' -s -w -X github.com/getstackhead/stackhead-cli/main.VERSION=${{steps.semrel.outputs.version}}" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" .
49+
cd bin/ && shasum -a 256 * > ./stackhead-cli_v${{steps.semrel.outputs.version}}_checksums.txt && cd -
50+
if: steps.semrel.outputs.version != ''
51+
env:
52+
CGO_ENABLED: 0
53+
- run: ghr $(cat .ghr) bin/
54+
if: steps.semrel.outputs.version != ''
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.semrelrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"plugins": {
3+
"ci-condition": {
4+
"name": "github",
5+
"options": {
6+
"defaultBranch": "master"
7+
}
8+
},
9+
"changelog-generator": {
10+
"name": "default",
11+
"options": {
12+
"emojis": "true"
13+
}
14+
},
15+
"provider": {
16+
"name": "github"
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)