diff --git a/appveyor.yml b/appveyor.yml index 6c2c2ddf5..d30cb0e15 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -286,28 +286,34 @@ cmake --build . --target documentation -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - if ($? -And $env:BOND_TOKEN -And $env:APPVEYOR_REPO_BRANCH -eq "master") { + if (($LASTEXITCODE -eq 0) -And ($env:BOND_TOKEN) -And ($env:APPVEYOR_REPO_BRANCH -eq "master")) { git config --global user.email "bondlab@microsoft.com" git config --global user.name "Appveyor" - git clone -b gh-pages "https://${env:BOND_TOKEN}@github.com/microsoft/bond.git" gh-pages 2>&1 | out-null + git clone -b gh-pages "https://${env:BOND_TOKEN}@github.com/microsoft/bond.git" gh-pages 2>&1 | Out-Null - cd gh-pages + if ($LASTEXITCODE -ne 0) { throw "Cloning gh-pages branch failed: $LASTEXITCODE" } - if (-not $?) { throw "Cloning gh-pages failed" } + cd gh-pages - Remove-Item * -Recurse + robocopy ..\html . /E /J /MIR /MT /NFL /XD .git 2>&1 - Copy-Item ..\html\* . -Recurse + if ($LASTEXITCODE -ne 0) { throw "Robocopy documentation failed: $LASTEXITCODE" } git add --all . + if ($LASTEXITCODE -ne 0) { throw "git add failed: $LASTEXITCODE" } + git commit -m "Update documentation" + if ($LASTEXITCODE -ne 0) { throw "git commit failed: $LASTEXITCODE" } + git push origin gh-pages 2>&1 | out-null + if ($LASTEXITCODE -ne 0) { throw "git push failed: $LASTEXITCODE" } + cd .. }