building on annotated tag

jfayre's Avatar

jfayre

01 Nov, 2020 03:04 PM

Hi,
I know this has been asked before, but I can't quite figure this out. I want to trigger a deploy on an annotated tag, but not a build on every branch. I only want to build on Master.
Here is my yml file:

version: 0.{build}
branches:
  only:
  - master
nuget:
  project_feed: true


environment: encFileKey: secure: IS92sMB8DjOsUUuLZRWCEHtM3s4a0TWtWojhyOXsxqk=


before_build: - cmd: nuget restore source\tfm.sln build: project: source\tfm.sln verbosity: minimal after_build: - ps: >- makensis /DVERSION=$env:APPVEYOR_REPO_TAG_NAME /DOUTFILE=tfm-$env:APPVEYOR_REPO_TAG_NAME-setup.exe installer\tfm.nsi

appveyor PushArtifact installer\tfm-$env:APPVEYOR_REPO_TAG_NAME-setup.EXE



deploy: - provider: FTP on: APPVEYOR_REPO_TAG: true host: myhost protocol: sftp username: user password: secure: gsDOGtodux/gAPPDTybI5w== folder: /public_html/snapshots

Thanks!

  1. Support Staff 1 Posted by Feodor Fitsner on 01 Nov, 2020 11:58 PM

    Feodor Fitsner's Avatar

    So, looks like webhook push request in your case doesn't have base_ref set and therefore AppVeyor sets branch name to tag name.

    Explanation from GitHub team:

    The base_ref will be populated with a branch name if the pushed tag directly references the same commit as the branch. For example, this happens when you tag the tip of the master branch with a lightweight tag.

    However, it won't happen if you tag some previous commit (which is not directly referenced by a branch) with a lightweight tag. Also, it will not happen with annotated tags since those tags point to tag objects, and not to commits directly (you'll notice that the "after" attribute for such pushes points to the SHA of the tag object, not the commit).

    and as you allow master branches only yout tag builds are filtered, correct?

    There is a couple of ways to fix:

    Option 1 - add tag name or regexp to the list of allowed branches, for example:

    branches:
      only:
      - master
      - /release-.*/
      - /^\d+\.\d+\.\d+(-\S*)?$/
    

    Option 2 - set APPVEYOR_IGNORE_COMMIT_FILTERING_ON_TAG "tweak" environment variable to true. More details are here in the bottom of the page.

    Let me know what worked.

  2. Feodor Fitsner closed this discussion on 02 Jan, 2021 09:03 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