Skip to content

Commit 3c34ebf

Browse files
authored
Merge pull request #45 from endlessm/push-oxovquoopkyv
Automate updating major version tag
2 parents 1dee82d + e079147 commit 3c34ebf

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Update major version tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.**'
7+
8+
jobs:
9+
update-major-version-tag:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Update major version tag
15+
shell: bash
16+
env:
17+
GIT_AUTHOR_NAME: 'GitHub Actions'
18+
GIT_COMMITTER_NAME: 'GitHub Actions'
19+
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
20+
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
21+
EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
22+
# Documentation of GITHUB_REF, GITHUB_REF_NAME and GITHUB_SHA:
23+
#
24+
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push
25+
# https://docs.github.com/en/actions/reference/variables-reference#default-environment-variables
26+
#
27+
# We want the major version tag to point to the target of the specific
28+
# tag, not to the tag, to avoid warnings about nested tags.
29+
run: |
30+
MAJOR_VERSION=${GITHUB_REF_NAME%%.*}
31+
git tag -f -a -m "Update $MAJOR_VERSION to $GITHUB_REF_NAME" $MAJOR_VERSION $GITHUB_SHA
32+
git push origin +$MAJOR_VERSION

0 commit comments

Comments
 (0)