File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- ---
2- name : Update Major Version
3- run-name : Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}
1+ name : Update Major Tag
42
53on :
6- workflow_dispatch :
7- inputs :
8- target :
9- description : " Target release tag (example: v1.2.0)"
10- required : true
11- major_version :
12- description : " Major version to update"
13- required : true
14- type : choice
15- options :
16- - v1
17- - v2
4+ push :
5+ tags :
6+ - " *.*.*"
187
198permissions :
209 contents : write
2110
2211jobs :
23- tag :
12+ update- tag :
2413 runs-on : ubuntu-latest
2514
2615 steps :
27- - name : 📦 Checkout Repository
16+ - name : Checkout repo
2817 uses : actions/checkout@v4
2918 with :
3019 fetch-depth : 0
3120
32- - name : Configure Git
21+ - name : Fetch tags
22+ run : git fetch --tags
23+
24+ - name : Configure git
3325 run : |
3426 git config user.name "github-actions[bot]"
3527 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3628
29+ - name : Extract major version
30+ id : version
31+ run : |
32+ TAG=${GITHUB_REF#refs/tags/}
33+
34+ echo "Release tag: $TAG"
35+
36+ # Extract major version from X.Y.Z
37+ MAJOR=$(echo "$TAG" | cut -d. -f1)
38+
39+ MAJOR_TAG="v$MAJOR"
40+
41+ echo "Major tag: $MAJOR_TAG"
42+
43+ echo "major_tag=$MAJOR_TAG" >> $GITHUB_OUTPUT
44+
3745 - name : Update major tag
3846 run : |
39- git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
47+ git tag -f ${{ steps.version.outputs.major_tag }} ${{ github.ref_name }}
4048
41- - name : Push updated tag
49+ - name : Push major tag
4250 run : |
43- git push origin ${{ github.event.inputs.major_version }} --force
44- ...
45-
51+ git push origin ${{ steps.version.outputs.major_tag }} --force
You can’t perform that action at this time.
0 commit comments