Skip to content

Commit 32c3f58

Browse files
committed
build: added github actions
1 parent 7e703be commit 32c3f58

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/on_push.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: on-push
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build_snapshot:
13+
name: Build Snapshot
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
with:
19+
# so we get proper snapshot version info
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: 1.18
26+
27+
- uses: actions/cache@v2
28+
with:
29+
path: |
30+
~/.cache/go-build
31+
~/go/pkg/mod
32+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
33+
restore-keys: |
34+
${{ runner.os }}-go-
35+
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v2
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
version: latest
42+
args: release --rm-dist --snapshot

.github/workflows/on_tag.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: tagged-release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
tagged-release:
10+
name: Tagged Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.18
20+
21+
- uses: actions/cache@v2
22+
with:
23+
path: |
24+
~/.cache/go-build
25+
~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
30+
- name: Run GoReleaser
31+
uses: goreleaser/goreleaser-action@v2
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
with:
35+
version: latest
36+
args: release --rm-dist

0 commit comments

Comments
 (0)