@@ -36,22 +36,32 @@ if ($Env:APPVEYOR_REPO_BRANCH -eq "production") {
3636if ($Env: APPVEYOR -eq " True" ) {
3737 Write-Host " Setting up git to publish site"
3838 git config -- global user.name " AppVeyor (on behalf of Craig Fowler)"
39- git config -- global user.email " craig+appveyor@csf-dev.com"
39+ git config -- global user.email " craig+appveyor@csf-dev.com"
4040 git config -- global credential.helper store
4141 Set-Content - Path " $HOME \.git-credentials" - Value " https://$ ( $Env: GITHUB_SECRET_KEY ) :x-oauth-basic@github.com`n " - NoNewline
4242}
4343
44- # Because of autocrlf, the git add command could report warnings which cause the script to
44+ # The git commands below could report warnings which cause the script to
4545# stop unless I change the error preference first
4646$ErrorActionPreference = " silentlycontinue"
4747
48+ Write-Host " Switching to a temp branch"
49+ git checkout - b temp/ publish-docs
50+
4851Write-Host " Adding content"
4952git add -- all docs/
5053
5154Write-Host " Creating commit"
5255git commit - m " Auto-publish docs website [skip ci]"
5356
54- if ($Env: APPVEYOR -eq " True" ) {
57+ if ($Env: APPVEYOR -eq " True" -and $Env: APPVEYOR_REPO_BRANCH -eq " production" ) {
58+ Write-Host " Pushing to origin"
59+ git checkout master
60+ git pull
61+ git merge temp/ publish-docs -- no- ff - m " Merge newly-published docs [skip ci]"
62+ git push origin master
63+ }
64+ elseif ($Env: APPVEYOR -eq " True" ) {
5565 Write-Host " Pushing to origin"
56- git push origin HEAD: $ Env: APPVEYOR_REPO_BRANCH
66+ git push origin temp / publish-docs :master
5767}
0 commit comments