-
Notifications
You must be signed in to change notification settings - Fork 24
39 lines (36 loc) · 1.15 KB
/
release.yml
File metadata and controls
39 lines (36 loc) · 1.15 KB
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
name: Release
on:
release:
branches: [main]
types: [released]
workflow_dispatch:
inputs:
tag:
description: 'which tag to update to'
default: 'v2'
required: true
ref:
description: 'which branch to update the tag on'
default: 'main'
required: true
permissions:
contents: write
jobs:
re-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true # needed for `git push`
fetch-depth: 0
ref: ${{ inputs.ref }}
- name: Config git name and email
run: |
git config user.name 'github-actions'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Update rolling tag
run: |
# Get the major version from the latest tag
MAJOR_VERSION=`git tag --list --sort=-v:refname | head -n1 | cut -d. -f1`
git tag --force --annotate ${{ inputs.tag || '$MAJOR_VERSION' }} --message 'Retag ${{ inputs.tag || '$MAJOR_VERSION' }}'
git push origin ${{ inputs.tag || '$MAJOR_VERSION' }} --force