tag:help.appveyor.com,2012-11-13:/discussions/problems/26934-azureblob-static-file-copyAppVeyor: Discussion 2020-06-22T05:58:19Ztag:help.appveyor.com,2012-11-13:Comment/482595912020-04-20T13:22:06Z2020-04-20T13:22:07ZAzureBlob static file copy<div><p>Hi,</p>
<p>I have an appveyor.yaml config file that goes something like:<br>
install: # Get the latest stable version of Node.js or io.js - ps: Install-Product node $env:nodejs_version # install modules - cmd: cd src\subscribers-app && npm install</p>
<p>#---------------------------------# # build configuration # #---------------------------------# matrix: fast_finish: true</p>
<p>build_script: - npm run build --prefix .\src\subscribers-app</p>
<p>deploy: - provider: AzureBlob storage_account_name: someazureaccountname storage_access_key: secure: areallysecurekey container: $web artifact: build set_content_type: false unzip: false on: branch: feature/somejirabranchname</p>
<p>I struggle to understand the "folder vs artifact" concept in order for the npm build results that are located in subscriber-app/build folder to be copied to $web container on azure. How and where do I reference the subscriber-app/build folder so it gets copied with all the files and subfolders to $web container on azure?<br>
Additionally, should be ZIPPING anything explicitly and how do I do that in that case?</p>
<p>Thanks!</p></div>rok.lenardictag:help.appveyor.com,2012-11-13:Comment/482595912020-04-21T04:19:50Z2020-04-21T04:20:16ZAzureBlob static file copy<div><p>Hi Rok,</p>
<p>Deployment provider works with artifacts, so to make it work artifacts must be uploaded to build results first: <a href="https://www.appveyor.com/docs/packaging-artifacts/">https://www.appveyor.com/docs/packaging-artifacts/</a></p>
<p>If you want to push the entire contents of <code>subscriber-app\build</code> dir as a single zip it could be something like (that path must be relative to build root folder):</p>
<pre>
<code>artifacts:
- path: subscriber-app\build
name: MyAppPackage</code>
</pre>
<p>Notice here, that I'm giving that artifact a "deployment name" (aka label) <code>MyAppPackage</code> to reference it later in deployment provider settings instead of path. Artifacts should appear on "Artifacts" tab of build results.</p>
<p>Then in deployment settings change <code>artifact: build</code> to <code>artifact: MyAppPackage</code> and set <code>unzip: true</code> to expand zip artifact inside <code>$web</code> container:</p>
<pre>
<code> deploy:
- provider: AzureBlob
storage_account_name: someazureaccountname
storage_access_key:
secure: areallysecurekey
container: $web
artifact: MyAppPackage
set_content_type: true
unzip: true
on:
branch: feature/somejirabranchname</code>
</pre>
<p>Let me know how that worked.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/482595912020-04-21T06:22:37Z2020-04-21T06:22:37ZAzureBlob static file copy<div><p>Feodor,</p>
<p>that did the trick but needed two tweak:<br>
1. as webpack config is set for the build folder to be on the root level, only .\build was enough for artifacts > path<br>
2. set_content_type had to be set to true otherwise when navigating to the page the browser downloads the index.html instead of showing it.</p>
<p>Below is the final version if anyone needs it at any point.</p>
<p>Thank you<br>
Rok</p>
<p>build_script: # Build and publish Host - npm run build --prefix .\src\subscribers-app</p>
<p>artifacts: - path: .\build name: packaged-app</p>
<p>#---------------------------------# # deployment configuration # #---------------------------------#</p>
<p>deploy: - provider: AzureBlob storage_account_name: someazureaccountname storage_access_key: secure: areallysecurekey container: $web artifact: packaged-app set_content_type: true unzip: true on: branch: feature/somejirabranchname</p></div>rok.lenardictag:help.appveyor.com,2012-11-13:Comment/482595912020-04-21T06:26:13Z2020-04-21T06:26:13ZAzureBlob static file copy<div><p>Cool, thanks for the update!</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/482595912020-04-21T06:44:07Z2020-04-21T06:44:07ZAzureBlob static file copy<div><p>Btw, any chance appveyor can do gzip compression for files and set AzureBlob file properties such as CacheControl = "max-age=864000, public, must-revalidate" and ContentEncoding = "gzip"?</p></div>rok.lenardic