Tag Release #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |