Skip to content

Commit 397c532

Browse files
committed
ci: add tag trigger and GitHub Release job
1 parent 16fae2a commit 397c532

1 file changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
67
pull_request:
78
branches: [main]
89

10+
permissions:
11+
contents: read
12+
913
jobs:
1014
test:
1115
name: go test (${{ matrix.os }})
@@ -16,12 +20,34 @@ jobs:
1620
os: [ubuntu-latest, macos-latest]
1721

1822
steps:
19-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2024

2125
- name: Set up Go
22-
uses: actions/setup-go@v5
26+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2327
with:
24-
go-version: "1.21"
28+
go-version: "1.22"
2529

2630
- name: go test
2731
run: go test -v ./...
32+
33+
# ── Create GitHub Release on tag push ─────────────────────────────────────
34+
release:
35+
name: GitHub Release
36+
runs-on: ubuntu-latest
37+
needs: test
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
40+
permissions:
41+
contents: write
42+
43+
steps:
44+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
46+
- name: Create Release
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: |
50+
gh release create "${{ github.ref_name }}" \
51+
--title "vastlint-go ${{ github.ref_name }}" \
52+
--generate-notes \
53+
--verify-tag

0 commit comments

Comments
 (0)