File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 BINARY_NAME : ice
1616
1717jobs :
18+ tag-on-message :
19+ # Auto-create a tag if the commit message on main looks like: release: vX.Y.Z
20+ if : github.ref == 'refs/heads/main'
21+ runs-on : ubuntu-latest
22+ permissions :
23+ contents : write
24+ steps :
25+ - uses : actions/checkout@v4
26+ with :
27+ fetch-depth : 0
28+ - name : Detect release commit message
29+ id : detect
30+ run : |
31+ msg="${{ github.event.head_commit.message }}"
32+ echo "Commit message: $msg"
33+ if [[ "$msg" =~ ^release:\ v([0-9]+\.[0-9]+\.[0-9]+)\b ]]; then
34+ ver="${BASH_REMATCH[1]}"
35+ echo "Matched version: $ver"
36+ echo "version=$ver" >> $GITHUB_OUTPUT
37+ echo "match=true" >> $GITHUB_OUTPUT
38+ else
39+ echo "No release pattern match (expected: release: vX.Y.Z)"
40+ echo "match=false" >> $GITHUB_OUTPUT
41+ fi
42+ - name : Create and push tag
43+ if : steps.detect.outputs.match == 'true'
44+ run : |
45+ ver="${{ steps.detect.outputs.version }}"
46+ if git rev-parse -q --verify "refs/tags/v$ver" >/dev/null; then
47+ echo "Tag v$ver already exists; skipping"
48+ exit 0
49+ fi
50+ git tag -a "v$ver" -m "Release v$ver"
51+ git push origin "v$ver"
52+
1853 build-matrix :
54+ if : startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
1955 name : build (${{ matrix.os }} ${{ matrix.goos }}-${{ matrix.goarch }})
2056 runs-on : ${{ matrix.os }}
2157 strategy :
You can’t perform that action at this time.
0 commit comments