Sure it’s possible. You could add [skip ci] or [skip netlify] anywhere to your commit message. Netlify won’t build for that commit. Then, when you release a tag (probably using a GitHub action), you can release a commit without the flags and Netlify will build for that commit.
I also prefer to only deploy git tags instead of every commit to the main branch. Is there a way to accomplish this which is more “opt-in” instead of “opt-out”?
As-in, I push a new tag, and maybe that tag has some message like [deploy netlify], to opt-in to deployment, rather than having to opt every commit out of deployment by including [skip netlify] every time.
Hey Paul and thanks for opening this thread so I could respond in more detail than I could on twitter.
To answer your high level we have no built-in tag handling logic or features in our platform. We don’t and probably won’t anytime soon respond to tag notifications from your git provider, and we don’t reliably fetch tags automatically, so to create a workflow like this, you’d need to do something like one of these workflows:
if you only ever tag HEAD of a branch, great! Put a post-commit hook or some other workflow in place to, upon tag, trigger a build hook for that site/branch
if you tag some older commit, that’s going to be tougher to handle, since we only build HEAD for the most part - you can’t trigger a build for an older commit. You could in this case build everything that might someday be tagged and thus published (you can still use Hrishikesh’s above advice, or an ignore script as described here to prevent builds that will never need to be published, and use a combination of locked deploys and API activation of old deploys (cf Netlify API documentation) which you’d trigger based on some local workflow (post-commit hook, github action, runbook where you find and publish the deploy in our UI, etc) to accomplish and hopefully automate the feature.
Note that if you need tag data present at Netlify, you will likely need to do pull it in during build, which is harder than it would seem since we have already dropped your Git authentication before we start your build. To accomplish that, here’s our best advice:
Hope that helps you build something that will work for you!