Skip to content

Commit d6d7609

Browse files
committed
Update workflow to support manual tag input and improve version extraction
1 parent 3fc61f1 commit d6d7609

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/update-major-tag.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ on:
44
release:
55
types: [published]
66

7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Release tag (e.g. v1.0.0)'
11+
required: true
12+
type: string
13+
714
permissions:
815
contents: write
916

@@ -13,15 +20,20 @@ jobs:
1320
steps:
1421
- name: Checkout
1522
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ inputs.tag || github.ref }}
25+
token: ${{ secrets.GH_PAT_FOR_UPDATE_TAG }}
1626

1727
- name: Extract major version
1828
id: version
1929
run: |
20-
TAG="${GITHUB_REF_NAME}" # e.g. v0.0.2
21-
MAJOR="${TAG%%.*}" # e.g. v0
30+
TAG="${{ inputs.tag || github.ref_name }}" # e.g. v1.0.0
31+
MAJOR="${TAG%%.*}" # e.g. v1
2232
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
2333
2434
- name: Update major version tag
2535
run: |
26-
git tag -fa "${{ steps.version.outputs.major }}" -m "Update ${{ steps.version.outputs.major }} to ${{ github.ref_name }}"
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git tag -fa "${{ steps.version.outputs.major }}" -m "Update ${{ steps.version.outputs.major }} to ${{ inputs.tag || github.ref_name }}"
2739
git push origin "${{ steps.version.outputs.major }}" --force

0 commit comments

Comments
 (0)