GitHub actions allow the use of branch and tag filters, but they don't seem to work together.
For example, this workflow runs on pushes to master or pushes with a tag.
name: npm Publish
on:
push:
branches:
- master
tags:
- v*
I want to setup a publishing workflow that runs on tagged pushes to master, not just one or the other. How can this be done?
One solution is to use on: release
instead of on: push
. This will trigger the workflow to execute when a release is published via the GitHub UI. When you publish a release on GitHub it tags the master
branch with the version of the release that you specify. Each execution of the workflow is therefore guaranteed to be a tagged commit on the master
branch.
name: npm Publish
on: release
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