-
Notifications
You must be signed in to change notification settings - Fork 210
45 lines (37 loc) · 1.3 KB
/
tag-release.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
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Tag Release
on:
workflow_dispatch: {}
permissions: {}
jobs:
tagrelease:
permissions:
contents: write # To create a branch and tags
runs-on: ubuntu-latest
steps:
- name: Show GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
shell: bash
- name: Check out code
uses: actions/checkout@v4
- name: Fetch all git tags
run: git fetch --tags origin
- name: Compute new version number
run: |
echo versionNumber=$(git tag -l --sort=version:refname | grep -v '-' | tail -1 | awk '{print $2 + 1}' FS='.') >> "$GITHUB_ENV"
- name: Create release branch
run: git checkout -b train-${{ env.versionNumber }}
- name: Initialize mandatory git config
run: |
git config user.name "${{ github.triggering_actor }}"
git config user.email "[email protected]"
- name: Commit update to branch
if: env.versionNumber != ''
run: |
git push origin train-${{ env.versionNumber }}
- name: Make a new tag
if: env.versionNumber != ''
run: |
git tag -a "v1.${{ env.versionNumber }}.0" -m "Train release ${{ env.versionNumber }}"
git push origin v1.${{ env.versionNumber }}.0