Last active
November 26, 2016 07:44
-
-
Save IlyaFinkelshteyn/90a5a04abcf3e657e24a2be79f54a1ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1.0.{build} | |
environment: | |
bbpwd: | |
secure: <encrypted_BitBucket_Password> | |
clone_script: | |
- ps: Write-Host "Preparing repo download environment..." | |
- ps: $bbUserName = $env:APPVEYOR_REPO_NAME.Substring(0, $env:APPVEYOR_REPO_NAME.IndexOf("/")) | |
- ps: $bytes = [System.Text.Encoding]::ASCII.GetBytes("$bbUserName" + ":" + "$env:bbpwd") | |
- ps: $credentials = [System.Convert]::ToBase64String($bytes) | |
- ps: $client = New-Object Net.WebClient | |
- ps: $client.Headers.Add("Authorization", "Basic $credentials") | |
- ps: $env:zipPath = "$($env:USERPROFILE)\$env:APPVEYOR_REPO_COMMIT.zip" | |
- ps: Write-Host "Downloading commit $env:APPVEYOR_REPO_COMMIT as a zip..." | |
- ps: $client.DownloadFile("https://bitbucket.org/$env:APPVEYOR_REPO_NAME/get/$env:APPVEYOR_REPO_COMMIT.zip", $env:zipPath) | |
- ps: Write-Host "Unzipping commit files to $env:APPVEYOR_BUILD_FOLDER..." | |
# we need to get rid of parent folder in archive but preserve directory structire | |
# this series of command achieves this | |
# note that it is good practise do cd %APPVEYOR_BUILD_FOLDER% in the end to continue build flow in default folder | |
- cd %USERPROFILE% | |
- mkdir extract | |
- cd extract | |
- 7z x %zipPath% | |
- ps: cd (Get-ChildItem)[0] | |
- xcopy * %APPVEYOR_BUILD_FOLDER% /s /i | |
- cd %APPVEYOR_BUILD_FOLDER% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment