tag:help.appveyor.com,2012-11-13:/discussions/questions/16858-is-there-a-way-to-provide-a-condition-for-an-artifactAppVeyor: Discussion 2018-10-19T08:18:38Ztag:help.appveyor.com,2012-11-13:Comment/445367722018-01-18T18:15:03Z2018-01-18T18:15:03ZIs there a way to provide a condition for an artifact?<div><p>You probably have</p>
<pre>
<code> on:
appveyor_repo_tag: true</code>
</pre>
<p>for GitHub deployment, right? So why not to set</p>
<pre>
<code> on:
appveyor_repo_tag: false</code>
</pre>
<p>for S3 one?</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/445367722018-01-18T21:29:23Z2018-01-18T21:29:23ZIs there a way to provide a condition for an artifact?<div><p>The problem is that the file I refer to as <code>gh/artifacts/path</code> in the artifacts section of <code>appveyor.yml</code> doesn't exist when I'm building an untagged build. I want to stop Appveyor from seeking it out unless <code>appveyor_repo_tag</code>, or some equivalent condition, is true. That answer doesn't seem to solve this problem at all.</p>
<p>To be clearer, what I want is:</p>
<p>Untagged build -> artifact for S3 is created and pushed.<br>
Tagged build -> artifact for S3 is created and pushed, separate artifact for GitHub is created and pushed.</p>
<p>and no warning messages.</p>
<p>Right now, I have everything working fine except the "no warning messages" part, because Appveyor thinks the artifact for the GitHub deployment should exist no matter what.</p></div>brianlheimtag:help.appveyor.com,2012-11-13:Comment/445367722018-01-18T22:52:54Z2018-01-18T22:52:54ZIs there a way to provide a condition for an artifact?<div><p>I see. Deployment part mislead me. This message is being risen by artifact packaging part, not deployment. I do not have a good answer for you. Here is pretty dirty hack to cheat AppVeyor which I do not like myself, but it will work with packing fake empty artifact:</p>
<pre>
<code>install:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq "false") {
$env:ARTIFACT_PATH = "$env:APPVEYOR_REPO_COMMIT"
$env:ARTIFACT_NAME = $env:ARTIFACT_PATH
New-Item -Path $env:ARTIFACT_PATH
}
else {
$env:ARTIFACT_PATH = "gh/artifacts/path"
$env:ARTIFACT_NAME = "art_gh"
}
artifacts:
- path: s3/artifacts/path
name: art_s3
- path: $(ARTIFACT_PATH)
name: $(ARTIFACT_NAME)</code>
</pre></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/445367722018-01-21T03:28:05Z2018-01-21T03:28:05ZIs there a way to provide a condition for an artifact?<div><p>Thanks!</p></div>brianlheim