-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.11 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Build and Release
on:
pull_request:
branches:
- main
- master
types:
- opened
- synchronize
paths:
- .github/workflows/build-release.yml
pull_request_target:
branches:
- main
- master
types:
- opened
- synchronize
- reopened
- closed
merge_group:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: 📥 Check out the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.merged == true && github.base_ref || github.event.pull_request.head.sha }}
- name: 🏷️ Bump version and push tag
id: tag-version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: "minor"
custom_release_rules: "feat:minor:✨ Features,fix:patch:🐛 Fixes,docs:patch:📰 Docs,chore:patch:🎨 Chore,pref:patch:🎈 Performance improvements,refactor:patch:🧹 Refactoring,build:patch:🔍 Build,ci:patch:🔍 CI,revert:patch:⏪ Revert,style:patch:🧹 Style,test:patch:👀 Test,release:major:📦 Release"
dry_run: ${{ github.event.pull_request.merged == true && 'false' || 'true' }}
- name: 🏷️ Fetch tags
run: git fetch --tags
- name: 🛠️ Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: 📦 Install dependencies
run: go mod download
- name: 🧪 Test
run: go test -v ./...
- name: 🚀 GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean ${{ github.event.pull_request.merged == false && '--skip=validate,publish --snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 📦 Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: 🧹 Check formatting
run: |
go fmt ./...
git diff --exit-code