"GitHub" deployment for branch "master" has been skipped because current branch is a {tag}

ahl's Avatar

ahl

13 Jul, 2022 02:04 PM

Hi,

I'm trying to publish a release to GitHub when build is started by a tag on master with the setting from the docs:

  on:
    branch: master # release from master branch only
    APPVEYOR_REPO_TAG: true # deploy on tag push only

But I get the following message, when it runs:

"GitHub" deployment for branch "master" has been skipped because current branch is "3.2.125"

Can it be done?

  1. Support Staff 1 Posted by Feodor Fitsner on 13 Jul, 2022 04:07 PM

    Feodor Fitsner's Avatar

    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 branch: master condition from deployment options.

  2. Support Staff 2 Posted by Feodor Fitsner on 13 Jul, 2022 04:13 PM

    Feodor Fitsner's Avatar
  3. 3 Posted by ahl on 13 Jul, 2022 06:21 PM

    ahl's Avatar

    Thanks for the quick reply! :)

    Removing `branch: master` 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.

    As when `git branch --contains tags/<tag>` returns master.

    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.

    I could do it by setting an environment variable and check it in `on:` I guess?

  4. Support Staff 4 Posted by Feodor Fitsner on 13 Jul, 2022 07:07 PM

    Feodor Fitsner's Avatar

    Right, using environment variable could be a good approach. You can have something, like this in PowerShell (not tested):

    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
    
  5. 5 Posted by ahl on 15 Jul, 2022 07:43 AM

    ahl's Avatar

    Thanks again.

    TAG_BRANCH will possible contain a list, does ...

     on:
        TAG_BRANCH: master

    check for contain or exact match?

  6. Support Staff 6 Posted by Feodor Fitsner on 15 Jul, 2022 03:01 PM

    Feodor Fitsner's Avatar

    yes, everything in on section should be exact match. You may try doing something like though:

    - 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('*', ' ')
        }
    
  7. Feodor Fitsner closed this discussion on 14 Sep, 2022 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac