Skip to content

Commit 01c1b7b

Browse files
committed
fix: update tag pattern for semantic versioning and add major version tag update step
1 parent a3e8081 commit 01c1b7b

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ main ]
66
tags:
7-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 including semver
7+
- 'v*.*.*' # Push events to matching semantic versions only (v1.0.0, v1.2.3, etc.)
88
pull_request:
99
branches: [ main ]
1010
workflow_dispatch:
@@ -287,4 +287,21 @@ jobs:
287287
name: Release ${{ github.ref_name }}
288288
generate_release_notes: true
289289
tag_name: ${{ github.ref }}
290-
token: ${{ secrets.GITHUB_TOKEN }}
290+
token: ${{ secrets.GITHUB_TOKEN }}
291+
292+
- name: Update major version tag
293+
if: ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}
294+
run: |
295+
# Extract major version from tag (e.g., v1.2.3 -> v1)
296+
TAG_NAME=${GITHUB_REF#refs/tags/}
297+
MAJOR_VERSION=$(echo $TAG_NAME | sed -E 's/^(v[0-9]+)\..*/\1/')
298+
299+
echo "Updating major version tag $MAJOR_VERSION to point to $TAG_NAME"
300+
301+
# Configure git
302+
git config user.name "github-actions[bot]"
303+
git config user.email "github-actions[bot]@users.noreply.github.com"
304+
305+
# Create/update the major version tag
306+
git tag -f $MAJOR_VERSION
307+
git push origin $MAJOR_VERSION --force

0 commit comments

Comments
 (0)