-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (32 loc) · 935 Bytes
/
versions.yaml
File metadata and controls
40 lines (32 loc) · 935 Bytes
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
33
34
35
36
37
38
39
40
name: Automatically update major tags
on:
push:
tags:
- "v*.*.*"
jobs:
update-major-tag:
name: Update major tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: true
- name: Configure git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Update tags
run: |
set -eu
NEW_TAG="${GITHUB_REF#refs/tags/}"
[ -z "$NEW_TAG" ] && exit 10
MAJOR=$(expr "$NEW_TAG" : '\(v[0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*$')
[ -z "$MAJOR" ] && exit 20
echo "Creating tag $MAJOR pointing to $NEW_TAG ..."
git fetch --tags
git tag -f "$MAJOR" "$NEW_TAG"
git push origin "$MAJOR" --force