Skip to content

Commit

Permalink
build: Add appveyor doc messages and new key
Browse files Browse the repository at this point in the history
Print more info on console when building docs in CI, and add key that
will push to gh-pages
  • Loading branch information
qdot committed Mar 31, 2018
1 parent eb9fa58 commit a347e03
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -14,7 +14,7 @@ environment:
sentry_api_url:
secure: grqYfjT9kMwONAdl/iwYcI7NOEd8ounzFFehZIWX3I3y1oiIa7F4GrZJKNqWcucEhyyn9SpAnXiheKAJU/kl0nFT7QUlnXplEE9c/krbWDEy0mSMy5DaFv1+MijZ5hjm
git_access_token:
secure: 6qJWs+pzFgvmZ5HObwXRJxZohaR0g21OEaV5LyomY455l6Qu2PX9zRkx8B4PHDrc
secure: SvHymEaf8z/NGLTrYUeI3PutAKTLiWlQtT0LVuVTkPGSG1uWXsF22ySBx4o/sRH1
git_email: build@appveyor.com
git_user: Appveyor Build

Expand Down
56 changes: 34 additions & 22 deletions docs/build.ps1
@@ -1,22 +1,33 @@
Write-Host "Branch: $env:APPVEYOR_REPO_BRANCH"
Write-Host "PR Number: $env:APPVEYOR_PULL_REQUEST_NUMBER"
Write-Host "Job Name: $env:APPVEYOR_JOB_NAME"
if ( $env:git_access_token ) {
Write-Host "Have Access Token"
} else {
Write-Host "Do Not Have Access Token"
}

if($env:APPVEYOR_REPO_BRANCH -eq "master" -and -not $env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_JOB_NAME -like "*Release*" -and $env:git_access_token){
$Deploy="true"
$Deploy="true"
Write-Host "Deploying docs"
} else {
Write-Host "Not deploying docs"
}

$docfxVersion = "2.33.0"
& nuget install docfx.console -Version $docfxVersion -Source https://api.nuget.org/v3/index.json

if($Deploy){
# Configuring git credentials
& git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:git_access_token):x-oauth-basic@github.com`n"
# Configuring git credentials
& git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:git_access_token):x-oauth-basic@github.com`n"

& git config --global user.email "$env:git_email"
& git config --global user.name "$env:git_user"
& git config --global core.safecrlf false
& git config --global user.email "$env:git_email"
& git config --global user.name "$env:git_user"
& git config --global core.safecrlf false

# Checkout gh-pages
git clone --quiet --no-checkout --branch=gh-pages https://github.com/$($env:APPVEYOR_REPO_NAME) gh-pages
# Checkout gh-pages
git clone --quiet --no-checkout --branch=gh-pages https://github.com/$($env:APPVEYOR_REPO_NAME) gh-pages
}

copy-item ..\README.md index.md
Expand All @@ -25,16 +36,17 @@ copy-item ..\*.md articles
& .\docfx.console.$docfxVersion\tools\docfx

if($Deploy){
git -C gh-pages status
$pendingChanges = git -C gh-pages status | select-string -pattern "Changes not staged for commit:","Untracked files:" -simplematch
if ($pendingChanges -ne $null) {
# Committing changes
git -C gh-pages add -A
git -C gh-pages commit -m "static site regeneration"
# Pushing changes
git -C gh-pages push --quiet origin gh-pages
}
else {
write-host "`nNo changes to documentation"
}
}
git -C gh-pages status
$pendingChanges = git -C gh-pages status | select-string -pattern "Changes not staged for commit:","Untracked files:" -simplematch
if ($pendingChanges -ne $null) {
# Committing changes
git -C gh-pages add -A
git -C gh-pages commit -m "static site regeneration"
# Pushing changes
git -C gh-pages push --quiet origin gh-pages
Write-Host "Docs deployed"
}
else {
write-host "`nNo changes to documentation"
}
}

0 comments on commit a347e03

Please sign in to comment.