-
Notifications
You must be signed in to change notification settings - Fork 365
32 lines (28 loc) · 864 Bytes
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Bump version
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: version-tag
uses: anothrNick/github-tag-action@1.42.0 # another pr require to move this to 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: version-tag-major
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch --tags
tagFmt="^v?[0-9]+\.[0-9]+\.[0-9]+$"
tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$tagFmt" | head -n 1)"
[[ "$tag" =~ ^([0-9]+) ]] # use ^(v[0-9]+) for vX
major=${BASH_REMATCH[1]}
# update major tag
git tag -f "$major"
git push -f origin "$major"