Skip to content

Commit 0bb1748

Browse files
committed
feat: setup workflows
1 parent 74cabd5 commit 0bb1748

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

.github/workflows/release.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Get Previous Version
25+
id: get_previous_version
26+
run: |
27+
PREV_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
28+
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT
29+
30+
- name: Generate Next Version
31+
id: semver
32+
uses: paulhatch/semantic-version@v5.4.0
33+
with:
34+
tag_prefix: "v"
35+
major_pattern: "BREAKING CHANGE:"
36+
minor_pattern: "feat:"
37+
version_format: "${major}.${minor}.${patch}-beta${increment}"
38+
39+
- name: Create and Push Tag
40+
run: |
41+
git config --global user.name ${{ secrets.GIT_USERNAME }}
42+
git config --global user.email ${{ secrets.GIT_EMAIL }}
43+
git tag -f v${{ steps.semver.outputs.version }}
44+
git push origin -f v${{ steps.semver.outputs.version }}
45+
46+
- name: Run GoReleaser
47+
uses: goreleaser/goreleaser-action@v6
48+
with:
49+
distribution: goreleaser
50+
version: latest
51+
args: release --clean
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
NEW_VERSION: v${{ steps.semver.outputs.version }}

.github/workflows/test.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.21
21+
22+
- name: Test
23+
run: go test -v ./...

0 commit comments

Comments
 (0)