Is there a possibility to tigger a github action only if a new version (which comes with a new tag) is pushed? I don't want run them on every push into master, but I also want to avoid creating a release branch.
Earlier this week, GitHub announced a new feature which allows developers to trigger workflows manually from within the “Actions” tab.
To run jobs sequentially, you can define dependencies on other jobs using the jobs. <job_id>. needs keyword. Each job runs in a runner environment specified by runs-on .
You can configure your workflows to run when specific activity on GitHub happens, at a scheduled time, or when an event outside of GitHub occurs.
Use the following syntax:
on: push: # Pattern matched against refs/tags tags: - '*' # Push events to every tag not containing /
For hierarchical tags:
on: push: # Pattern matched against refs/tags tags: - '**' # Push events to every tag including hierarchical tags like v1.0/beta
https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
I got it to work with
on: push: tags: - '*'
I found out that if the tag was previously created (locally) before the workflow was created, no matter how many times I deleted and re-pushed the tag, it would not trigger until I deleted the tag locally and recreated it. The action does not seem to work for tags created before the workflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With