I want to trigger a release github action only when these two conditions are true:
- I push a new tag
- The test github action (unit tests) was successfully run
This is what I tried:
name: Semantic Release
on:
push:
tags:
- 'v*'
workflow_run:
workflows:
- "test" # basically i have another test action to run unit tests
types:
- completed
jobs:
release:
name: "Release on Pypi"
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Python Semantic Release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
I set my test action to trigger when I push to master, which is working fine. However, the release action is always triggered after the test action even when I do not push a new tag.
I want the release action to trigger only when I push a new tag and wait for the test action to complete successfully. Why is my example is not working in this case?