tag:help.appveyor.com,2012-11-13:/discussions/problems/32758-github-deployment-for-branch-master-has-been-skipped-because-current-branch-is-a-tagAppVeyor: Discussion 2022-09-14T21:02:13Ztag:help.appveyor.com,2012-11-13:Comment/549851122022-07-13T14:04:40Z2022-07-13T14:04:40Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>Hi,</p>
<p>I'm trying to publish a release to GitHub when build is started by a tag on master with the setting from the docs:</p>
<p>on: branch: master # release from master branch only APPVEYOR_REPO_TAG: true # deploy on tag push only</p>
<p>But I get the following message, when it runs:</p>
<p>"GitHub" deployment for branch "master" has been skipped because current branch is "3.2.125"</p>
<p>Can it be done?</p></div>ahltag:help.appveyor.com,2012-11-13:Comment/549851122022-07-13T16:07:10Z2022-07-13T16:07:10Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>In tag builds if branch information cannot be provided by GitHub/GitLab/etc. API branch is replaced with tag name. In general, tag is not always bound to a branch, it points to a specific commit which could belong to any branch. Just remove <code>branch: master</code> condition from deployment options.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/549851122022-07-13T16:13:35Z2022-07-13T16:13:35Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>More info on the tags: <a href="https://stackoverflow.com/a/27154277/1435891">https://stackoverflow.com/a/27154277/1435891</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/549851122022-07-13T18:21:07Z2022-07-13T18:21:07Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>Thanks for the quick reply! :)</p>
<p>Removing <code>branch: master</code> won't exactly do what I need though, I think. I would like to only deploy to github if the commit the pushed tag points to is also contained in master.</p>
<p>As when <code>git branch --contains tags/<tag></code> returns master.</p>
<p>The purpose of it all is to say that pre-releases, which are tags that will always be pushed on other branches than master, should not be released to github, but only to another nuget provider.</p>
<p>I could do it by setting an environment variable and check it in <code>on:</code> I guess?</p></div>ahltag:help.appveyor.com,2012-11-13:Comment/549851122022-07-13T19:07:52Z2022-07-13T19:08:15Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>Right, using environment variable could be a good approach. You can have something, like this in PowerShell (not tested):</p>
<pre>
<code>before_deploy:
- ps: $env:TAG_BRANCH = $(git branch --contains tags/$env:APPVEYOR_REPO_TAG_NAME)
deploy:
...
on:
TAG_BRANCH: master
APPVEYOR_REPO_TAG: true # deploy on tag push only</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/549851122022-07-15T07:43:40Z2022-07-15T07:43:40Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>Thanks again.</p>
<p>TAG_BRANCH will possible contain a list, does ...</p>
<p>on: TAG_BRANCH: master</p>
<p>check for contain or exact match?</p></div>ahltag:help.appveyor.com,2012-11-13:Comment/549851122022-07-15T15:01:30Z2022-07-15T15:01:30Z"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}<div><p>yes, everything in <code>on</code> section should be exact match. You may try doing something like though:</p>
<pre>
<code>- ps: |
$tag_branches = $(git branch --contains tags/$env:APPVEYOR_REPO_TAG_NAME)
if ($tag_branches.length -gt 0) {
$env:TAG_BRANCH = $tag_branches[0].trim('*', ' ')
}</code>
</pre></div>Feodor Fitsner