I try to set up a CI build that runs a normal build when something gets pushed to master. (https://github.com/esrlabs/chipmunk/actions)
this is the trigger section of my workflow:
name: Main on: push
so that is clear.
What I now try to do is to have a conditional step that is only executed if a tag is pushed
- name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/')
now when I push some commit to master and also tag it, I have 2 git-level operations and this results in running my workflow twice. But since the tag command triggers actions that include those I get on a push command, I'd like to skip this and only react to the tag command.
I tried the --follow-tags option for the git push command but apparently this still ends up in 2 distinct git operations.
Is there a way to avoid the first trigger in case of a pushed git tag?
You can configure push to only trigger for tags, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-g... for more details.
thanks for your response @chrispat
I know I can restrict my workflow to be triggered only on push events that push a tag to GitHub.
my case is different:
what I would want is to atomically push one commit including the tag to GitHub. but those are 2 separate triggers.
a solution could look like: