Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Created January 11, 2017 21:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/7de4b7d11b21ad8c626f52c875ea7c49 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/7de4b7d11b21ad8c626f52c875ea7c49 to your computer and use it in GitHub Desktop.
# Preparation steps:
# On local machine (or you can use https://www.appveyor.com/docs/how-to/rdp-to-build-worker/ instead):
# Install https://pub.storage.googleapis.com/gsutil.zip
# Run gsutil config and complete authentication and configuration
# Check that "$env:USERPROFILE\.boto" created
# Optionally cleanup "$env:USERPROFILE\.boto" (remove comments) and add some additional configuration if needed
# Encode .boto file as a Base64 string (PowerShell sample):
# $bytes = [System.IO.File]::ReadAllBytes("$env:USERPROFILE\.boto")
# [System.Convert]::ToBase64String($bytes)
# Encrypt result with https://ci.appveyor.com/tools/encrypt
# Enter encrypted value as a secure variable into you YAML config.
version: 1.21.{build}
environment:
boto:
secure: GAlrMAD/Lqn0K85qxoSxbp2WpFwOQpV4Q28mGALTKxdrBmrZLLJSNAIejqCNj2EaZQjhmvVS3D2P7BulhgkrN8UxxRRSjsH6Q53l2FDVutDdzP31Z7rybgN4EdkMMlEQ+mshRKOYZ4JAae1T60u2zMuVzC1JQ6bNgjTt8f/mL0nM0sEsqwfkh6JhnIk/MC+Kl+t/m6Xt8D6aamu3po58MOQoJqI/XKqF5fPYlreLAUUnapB0+4hHr3jTzYAVz8GfXg2/zL0xPHdf8daosk7A7VAueVMdAGIPfog72VO9kccwgT0iqJ5X1QveO4fROxp8iQow9uxS/4W1TzJhTIiToH6N8zsf3Cotzi/lercrMCGqp8XR0sEBv0hUCj/j1nUiTNwOOUs5KdvoIUK9rA7BgxborBqsqQ/3fiqfMPz9Jf5ZkU6JcERyUKeErd4HNuIv
install:
# Download gsutil, unzip it and populate .boto file locally
- ps: >-
$zipPath = "$env:APPVEYOR_BUILD_FOLDER\gsutil.zip"
(New-Object System.Net.WebClient).DownloadFile('https://pub.storage.googleapis.com/gsutil.zip', $zipPath)
7z x $zipPath -y | Out-Null
$bytes = [System.Convert]::FromBase64String($env:boto)
[System.IO.File]::WriteAllBytes("$env:USERPROFILE\.boto", $bytes)
build:
project: src\MyProject.sln
verbosity: minimal
artifacts:
- path: src\MyProject\bin\Debug\
name: MyProject
deploy_script:
# Upload all zip files from artifacts.
# You upload by simple using local paths, but it is better to do this with $artifacts as you are in 100% sync with artifacts
# Or is simple do `- gsutil\gsutil cp <local_file_path> gs://my-test-bucket (thus avoiding NativeCommandError in build log)
- ps: $artifacts.values | Where-Object { $_.path -like '*.zip' } | ForEach-Object {.\gsutil\gsutil cp $_.path gs://my-test-bucket}
- ps: Write-Host "Please ignore NativeCommandError above, this is because gsutil writes output to stdErr" -foregroundcolor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment