Check and create tag #5
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: Check and create tag | |
on: | |
workflow_run: | |
workflows: ["Lint Python code with Ruff"] | |
types: | |
- completed | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
paths: | |
- vswobbly/_metadata.py | |
jobs: | |
new_version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version number | |
run: | | |
echo "CURR_VER=v$(python -c "import runpy;runpy.run_path('vswobbly/_metadata.py', None, '__github__')")" >> $GITHUB_ENV | |
- name: Check if version exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: mukunku/[email protected] | |
id: tagcheck | |
with: | |
tag: ${{ env.CURR_VER }} | |
- name: Make tag | |
uses: actions/github-script@v7 | |
if: steps.tagcheck.outputs.exists == 'false' | |
with: | |
github-token: ${{ secrets.AUTOTAG_TOKEN }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${process.env.CURR_VER}`, | |
sha: context.sha | |
}) | |
- name: Fallback | |
if: steps.tagcheck.outputs.exists == 'true' | |
run: echo "Nothing to see here, move along citizen" |