Skip to content

Commit d3d0b28

Browse files
authored
feat: Add .github workflow for release/test (#2)
Co-authored-by: Kemal Hadimli <[email protected]>
1 parent 0f27e49 commit d3d0b28

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/release.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*.*.*"
6+
env:
7+
CGO_ENABLED: 0
8+
9+
jobs:
10+
release-binary:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# This fails for invalid semver strings
14+
- name: Parse semver string
15+
id: semver_parser
16+
uses: booxmedialtd/ws-action-parse-semver@966a26512c94239a00aa10b1b0c196906f7e1909
17+
with:
18+
input_string: ${{github.ref_name}}
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Go 1.x
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version-file: go.mod
27+
cache: true
28+
- name: Run GoReleaser Dry-Run
29+
uses: goreleaser/goreleaser-action@v3
30+
with:
31+
version: latest
32+
args: release --rm-dist --skip-validate --skip-publish --skip-sign
33+
- name: Run GoReleaser
34+
uses: goreleaser/goreleaser-action@v3
35+
with:
36+
version: latest
37+
args: release --rm-dist --skip-sign
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
test:
12+
timeout-minutes: 30
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 2
18+
- name: Set up Go 1.x
19+
uses: actions/setup-go@v3
20+
with:
21+
go-version-file: go.mod
22+
cache: true
23+
- name: golangci-lint
24+
uses: golangci/golangci-lint-action@v3
25+
with:
26+
version: v1.50.1
27+
- name: Get dependencies
28+
run: go get -t -d ./...
29+
- name: Build
30+
run: go build .
31+
- name: Test
32+
run: make test
33+
- name: gen
34+
if: github.event_name == 'pull_request'
35+
run: make gen
36+
- name: Fail if generation updated files
37+
if: github.event_name == 'pull_request'
38+
run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1)

0 commit comments

Comments
 (0)