Only PushArtifact on master branch
I have some commands that I'd like to run under the after_test portion of the appveyor.yml file:
- cd %APPVEYOR_BUILD_FOLDER%
# Create a nupkg. The install directory is to be packaged.
- nuget pack .simbody.nuspec -BasePath C:\simbody
# The line above creates the file simbody.0.0.0.nupkg.
# Push this to Appveyor's NuGet account feed, to be used by OpenSim.
- appveyor PushArtifact simbody.0.0.0.nupkg
However, I only want these lines to run on the master branch.
What is the easiest way to do this? I'd prefer not to start each of the above lines with "IF "%APPVEYOR_REPO_BRANCH%"=master (my knowledge of batch is not good).
I know I can create a NuGet deployment that only runs on certain branches, but I'd prefer to use the PushArtifact one-liner, which allows me to not specify ApiKey, source URL, etc.
Thank you!
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
1 Posted by chrisdembia on 27 Nov, 2014 01:16 AM
I know one option is to have two sections in my yaml file, one for the master branch ando one for all others. However, I want to avoid copying and pasting my entire script for the master branch.
Support Staff 2 Posted by Feodor Fitsner on 27 Nov, 2014 03:59 AM
Yes, you can test
APPVEYOR_REPO_BRANCH
variable. I'm not a batch fan too, so I'd do it with PowerShell :)3 Posted by chrisdembia on 05 Dec, 2014 07:25 PM
Thanks Feodor, that worked. The issue is now that I only want to execute some commands on the master branch, AND if the build is NOT part of a pull request. The value of APPVEYOR_REPO_BRANCH is master if a PR is merging into master, but I don't want to run these certain commands on PR's.
So I was thinking I could check the value of APPVEYOR_PULL_REQUEST_NUMBER. What is the value of the variable if NOT building a PR? Is the variable undefined? Is it 0?
Support Staff 4 Posted by Feodor Fitsner on 05 Dec, 2014 07:35 PM
It's undefined.
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:50 AM.