Skip to content

Commit

Permalink
[doc] Switch to robocopy to mirror doc build output
Browse files Browse the repository at this point in the history
We're having trouble using the Remove-Item/Copy-Item pair to synchronize
the documentation build output with the gh-pages branch.

Switch to robocopy, which has a /MIR (mirror) mode as well as
/XD (exclude directory).

Test $LASTEXITCODE instead of $?. Due to how PowerShell handles the
error stream, $? is set to false if the process writes to stderr, even
if the process exits with 0.
  • Loading branch information
chwarr authored Mar 10, 2021
1 parent 27da749 commit e5e2aaf
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
}
Expand Down

0 comments on commit e5e2aaf

Please sign in to comment.