Skip to content

Commit d527c0f

Browse files
committed
ci(release): add GoReleaser and release-please for semantic versioning
Set up automated releases using release-please to create version PRs from conventional commits, and GoReleaser to publish GitHub releases.
1 parent ca98ef1 commit d527c0f

File tree

4 files changed

+101
-0
lines changed

4 files changed

+101
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
steps:
19+
- uses: googleapis/release-please-action@v4
20+
id: release
21+
with:
22+
release-type: go
23+
24+
goreleaser:
25+
needs: release-please
26+
if: ${{ needs.release-please.outputs.release_created }}
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
35+
- uses: actions/setup-go@v5
36+
with:
37+
go-version-file: go.mod
38+
39+
- uses: goreleaser/goreleaser-action@v6
40+
with:
41+
version: "~> v2"
42+
args: release --clean
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# GoReleaser config for a Go library (no binary builds).
2+
version: 2
3+
4+
builds:
5+
- skip: true
6+
7+
changelog:
8+
sort: asc
9+
filters:
10+
exclude:
11+
- "^docs:"
12+
- "^test:"
13+
- "^chore\\(deps\\):"
14+
groups:
15+
- title: "Breaking Changes"
16+
regexp: '^.*?!:.+$'
17+
order: 0
18+
- title: "Features"
19+
regexp: '^feat.*'
20+
order: 1
21+
- title: "Bug Fixes"
22+
regexp: '^fix.*'
23+
order: 2
24+
- title: "Performance"
25+
regexp: '^perf.*'
26+
order: 3
27+
- title: "Other"
28+
order: 999
29+
30+
release:
31+
github:
32+
owner: zerfoo
33+
name: float16
34+
prerelease: auto
35+
make_latest: true

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

release-please-config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "go",
5+
"bump-minor-pre-major": true,
6+
"bump-patch-for-minor-pre-major": true,
7+
"changelog-sections": [
8+
{ "type": "feat", "section": "Features" },
9+
{ "type": "fix", "section": "Bug Fixes" },
10+
{ "type": "perf", "section": "Performance" },
11+
{ "type": "refactor", "section": "Refactoring" },
12+
{ "type": "docs", "section": "Documentation", "hidden": true },
13+
{ "type": "test", "section": "Tests", "hidden": true },
14+
{ "type": "chore", "section": "Miscellaneous", "hidden": true }
15+
]
16+
}
17+
},
18+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
19+
}

0 commit comments

Comments
 (0)