Skip to content

Commit 5cfac01

Browse files
committed
add release job
1 parent 1720c87 commit 5cfac01

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
name: unit-tests
1+
name: tests-and-release
22

33
on:
44
pull_request:
55
workflow_dispatch:
66
push:
77
branches:
88
- main
9+
tags:
10+
- "*"
11+
12+
permissions:
13+
contents: write
14+
15+
env:
16+
GO_VERSION: "1.22"
917

1018
jobs:
1119
unit-test:
@@ -17,7 +25,30 @@ jobs:
1725
- name: set up go
1826
uses: actions/setup-go@v5
1927
with:
20-
go-version: "1.22"
28+
go-version: ${{ env.GO_VERSION}}
2129

2230
- name: unit tests
2331
run: go test ./...
32+
33+
release:
34+
runs-on: ubuntu-latest
35+
needs: unit-test
36+
if: startsWith(github.ref, 'refs/tags/')
37+
steps:
38+
- name: checkout
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
43+
- name: set up go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ env.GO_VERSION}}
47+
48+
- name: create release
49+
uses: goreleaser/goreleaser-action@master
50+
with:
51+
version: latest
52+
args: release --clean
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)