-
Notifications
You must be signed in to change notification settings - Fork 210
60 lines (51 loc) · 1.67 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Tag Release
on:
workflow_dispatch: {}
permissions: {}
jobs:
tagrelease:
permissions:
contents: write # To create a branch and tags
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.echo.outputs.tag }}
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: Add git tag to output
id: echo
run: |
echo tag=v1.${{ env.versionNumber }}.0 >> $GITHUB_OUTPUT
- 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
docker:
uses: ./.github/workflows/docker.yml
with:
git_tag: ${{ needs.tagrelease.outputs.TAG }}
needs: tagrelease
permissions:
contents: read
id-token: write