Skip to content

Commit 063ba12

Browse files
authored
ci: add release workflow, commitlint (#3)
add automated tags/releases with semantic-release add commitlint to validate commits (in order for semantic-release to work as expected) add automated binary publishing to releases
1 parent df7659c commit 063ba12

File tree

3 files changed

+73
-12
lines changed

3 files changed

+73
-12
lines changed

.github/workflows/build.yml

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
1-
name: Pipeline
1+
name: Push workflow
22

33
on: push
44

55
jobs:
66
build:
77
runs-on: ubuntu-latest
8-
98
steps:
10-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v2
10+
- name: Setup Go
11+
uses: actions/setup-go@v2
12+
with:
13+
go-version: '1.16'
14+
- name: Run build
15+
run: |
16+
go build .
1117
12-
- name: Setup Go
13-
uses: actions/setup-go@v2
14-
with:
15-
go-version: '1.16'
18+
lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Setup Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: '1.16'
26+
- name: Run go vet
27+
run: go vet .
1628

17-
- name: Run build
18-
run: |
19-
go build .
29+
commitlint:
30+
name: Commit Lint
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v2
35+
with:
36+
fetch-depth: 0
37+
- name: Lint Commit
38+
uses: wagoid/commitlint-github-action@v3
2039

21-
- name: Run go vet
22-
run: go vet .
40+
release:
41+
name: Release
42+
needs: [build, lint, commitlint]
43+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
- name: Setup Node.js
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: 14
52+
- name: Release
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
55+
run: npx semantic-release

.github/workflows/push.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release workflow
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
release-linux-amd64:
9+
name: release linux/amd64
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Publish binaries to release
14+
uses: wangyoucao577/[email protected]
15+
with:
16+
github_token: ${{ secrets.GITHUB_TOKEN }}
17+
goos: linux
18+
goarch: amd64

releaserc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/github"
9+
]
10+
}

0 commit comments

Comments
 (0)