Skip to content

Commit a0cf79b

Browse files
authored
Merge pull request #120 from github-community-projects/jm_major_version_updater
feat: add automatic major version tag update to release workflow
2 parents 469b195 + 2ce2ae3 commit a0cf79b

5 files changed

Lines changed: 36 additions & 64 deletions

File tree

.github/workflows/major-version-updater.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
release-config-name:
1111
required: true
1212
type: string
13+
update-major-tag:
14+
required: false
15+
type: boolean
16+
default: true
1317
secrets:
1418
github-token:
1519
required: true
@@ -62,3 +66,30 @@ jobs:
6266
run: |
6367
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
6468
echo "SHORT_TAG=$short_tag" >> "$GITHUB_OUTPUT"
69+
70+
update_major_tag:
71+
needs: create_release
72+
if: ${{ inputs.update-major-tag && needs.create_release.outputs.full-tag != '' }}
73+
runs-on: ubuntu-latest
74+
permissions:
75+
contents: write
76+
steps:
77+
- name: Harden the runner (Audit all outbound calls)
78+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
79+
with:
80+
egress-policy: audit
81+
82+
- name: Checkout Repo
83+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+
with:
85+
fetch-tags: true
86+
ref: ${{ needs.create_release.outputs.full-tag }}
87+
persist-credentials: true
88+
89+
- name: Force update major tag
90+
run: |
91+
git tag -f "${SHORT}" "${FULL}"
92+
git push -f origin "${SHORT}"
93+
env:
94+
SHORT: ${{ needs.create_release.outputs.short-tag }}
95+
FULL: ${{ needs.create_release.outputs.full-tag }}

.github/workflows/test-major-version-updater.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ ignore.*
1919
.env
2020
.env.test
2121
*.pem
22+
23+
# ai
24+
**/.claude/*.local.*

docs/release.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# The name of the configuration file to use, default is release-drafter.yml
1414
# from the release-drafter/release-drafter GitHub Action
1515
release-config-name: release-drafter.yml
16+
# Boolean flag whether to update major tag to latest full semver tag, default is true
17+
update-major-tag: true
1618
secrets:
1719
# The GitHub token to use
1820
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)