Skip to content

Commit 7cc119d

Browse files
committed
ci: build and publish when tagging
1 parent 2791272 commit 7cc119d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
on:
44
push:
55
branches: [ main ]
6+
tags:
7+
- 'v*'
68
pull_request:
79
branches: [ main ]
810

@@ -95,3 +97,41 @@ jobs:
9597
with:
9698
name: build-artifacts
9799
path: dist/
100+
101+
release:
102+
if: github.ref_type == 'tag'
103+
runs-on: ubuntu-latest
104+
needs: [build]
105+
steps:
106+
- name: Checkout code
107+
uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
111+
- name: Set up Go
112+
uses: actions/setup-go@v5
113+
with:
114+
go-version: '1.22'
115+
check-latest: true
116+
117+
- name: Run tests
118+
run: go test -v ./...
119+
120+
- name: Run GoReleaser
121+
if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
122+
uses: goreleaser/goreleaser-action@v6
123+
with:
124+
version: latest
125+
args: release --clean
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
129+
130+
- name: Run GoReleaser (skip Homebrew tap update)
131+
if: ${{ secrets.HOMEBREW_TAP_TOKEN == '' }}
132+
uses: goreleaser/goreleaser-action@v6
133+
with:
134+
version: latest
135+
args: release --clean --skip=brews
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)