Tag version #47
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 version" | |
on: | |
workflow_run: | |
workflows: ["Test, Lint and Build"] | |
branches: [main] | |
types: | |
- completed | |
jobs: | |
push_version_tag: | |
runs-on: ubuntu-latest | |
env: | |
PYTHONPATH: "lib/:${PYTHONPATH}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup virtualenv | |
uses: ./.github/actions/setup-venv | |
with: | |
venv-path: .venv | |
- name: Get version tag | |
id: get-tag | |
run: printf "tag=v%s" $(.venv/bin/python3 -m poetry version --short) >> $GITHUB_OUTPUT | |
- name: Check tag exists | |
continue-on-error: true | |
id: check-tag-exists | |
run: git ls-remote --exit-code origin refs/tags/${{ steps.get-tag.outputs.tag }} | |
- name: Make tag | |
if: ${{ steps.check-tag-exists.outcome == 'failure' }} | |
run: | | |
git config user.name '${{ github.actor }}' | |
git config user.email '<>' | |
git tag -a \ | |
-m '${{ steps.get-tag.outputs.tag }} release tag' \ | |
${{ steps.get-tag.outputs.tag }} ${{ github.sha }} | |
git push origin tag ${{ steps.get-tag.outputs.tag }} | |