File tree Expand file tree Collapse file tree 7 files changed +74
-17
lines changed
Expand file tree Collapse file tree 7 files changed +74
-17
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ branches:
99 - /^feature\/.*/
1010build_script :
1111 - ps : .\build.ps1 -IsOfficialBuild
12- - ps : .\docs\generate.ps1
12+ - ps : .\docs\generate.ps1 -NoBuild
13+ on_success :
14+ - ps : .\docs\push.ps1 -AppVeyor
1315environment :
16+ access_token :
17+ secure : 7gza5cyC0Fwp5LcFPz9dGMcHXP2jxbrnu7er9R/HkdvnhzGJVADvOtfYO7+Vow5p
1418 global :
1519 DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
1620 DOTNET_CLI_TELEMETRY_OPTOUT : 1
@@ -30,3 +34,13 @@ deploy:
3034 branch : master
3135 api_key :
3236 secure : KF1yGk4IHJyyfiHfFSCxJ+p5iZX+KPfCTnCihjD5iIZjasTS1lHeilpbaon4wvcM
37+ - provider : GitHub
38+ description : ' See https://github.com/natemcmaster/CommandLineUtils/blob/master/CHANGELOG.md for details'
39+ auth_token :
40+ secure : 7gza5cyC0Fwp5LcFPz9dGMcHXP2jxbrnu7er9R/HkdvnhzGJVADvOtfYO7+Vow5p
41+ artifact : Packages
42+ draft : false
43+ prerelease : false
44+ on :
45+ branch : master # release from master branch only
46+ appveyor_repo_tag : true # deploy on tag push only
Original file line number Diff line number Diff line change @@ -12,16 +12,7 @@ param(
1212Set-StrictMode - Version 1
1313$ErrorActionPreference = ' Stop'
1414
15- function exec ([string ]$_cmd ) {
16- write-host - ForegroundColor DarkGray " >>> $_cmd $args "
17- $ErrorActionPreference = ' Continue'
18- & $_cmd @args
19- $ErrorActionPreference = ' Stop'
20- if ($LASTEXITCODE -ne 0 ) {
21- write-error " Failed with exit code $LASTEXITCODE "
22- exit 1
23- }
24- }
15+ Import-Module - Force - Scope Local " $PSScriptRoot /src/common.psm1"
2516
2617#
2718# Main
Original file line number Diff line number Diff line change 1+ Looking to read docs? Visit https://natemcmaster.github.io/CommandLineUtils/
2+
3+ Looking to help write docs? Checkout [ CONTRIBUTING.md] ( ../CONTRIBUTING.md )
Original file line number Diff line number Diff line change 3737 ],
3838 "exclude" : [
3939 " **/obj/**" ,
40- " **.meta"
40+ " **.meta" ,
41+ " README.md"
4142 ]
4243 }
4344 ],
Original file line number Diff line number Diff line change 66$ErrorActionPreference = ' Stop'
77Set-StrictMode - Version 2
88
9+ Import-Module - Force - Scope Local " $PSScriptRoot /src/common.psm1"
10+
911Push-Location " $PSScriptRoot /../"
1012
1113try {
1517 New-Item - ItemType Directory $buildRoot - ErrorAction Ignore
1618
1719 if (-not (git worktree list -- porcelain | Select-String ' gh-pages' )) {
20+ & git fetch origin gh- pages
1821 & git worktree add $targetDir gh- pages
1922 }
2023
@@ -30,24 +33,24 @@ try {
3033 }
3134
3235 Push-Location $targetDir
33- git rm -- quiet -- force - r .
36+ & git rm -- quiet -- force - r .
3437 Pop-Location
3538
3639 if (-not $NoBuild ) {
37- & dotnet build - c Release
40+ exec dotnet build - c Release
3841 }
3942
4043 $arguments = @ ()
4144 try {
4245 if ($Serve ) {
4346 $arguments += ' --serve'
4447 }
45- & $docfx docs/ docfx.json @arguments
48+ exec $docfx docs/ docfx.json @arguments
4649 }
4750 finally {
4851 Push-Location $targetDir
49- git add ./
50- git -- no- pager status - s
52+ & git add ./
53+ & git -- no- pager status - s
5154 Pop-Location
5255 }
5356}
Original file line number Diff line number Diff line change 1+ # requires -version 5
2+ param (
3+ [string ]$SourceCommit ,
4+ [switch ]$DryRun ,
5+ [switch ]$AppVeyor
6+ )
7+
8+ $ErrorActionPreference = ' Stop'
9+ Set-StrictMode - Version 2
10+
11+ Import-Module - Force - Scope Local " $PSScriptRoot /../src/common.psm1"
12+
13+ $workdir = " $PSScriptRoot /../.build/docs/gh-pages"
14+ Push-Location $workdir
15+ try {
16+
17+ if ($AppVeyor ) {
18+ exec git config -- global credential.helper store
19+ Add-Content " $HOME \.git-credentials" " https://$ ( $env: access_token ) :[email protected] `n " 20+ exec git config -- global user.email $env: APPVEYOR_REPO_COMMIT_AUTHOR
21+ exec git config -- global user.name $env: APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL
22+ $SourceCommit = $env: APPVEYOR_REPO_COMMIT
23+ }
24+
25+ if (-not $SourceCommit ) {
26+ Push-Location $PSScriptRoot
27+ $SourceCommit = $ (git rev- parse HEAD)
28+ Pop-Location
29+ }
30+ exec git commit - m " Generate documentation from $SourceCommit "
31+ exec git push -- dry- run
32+ }
33+ finally {
34+ Pop-Location
35+ }
Original file line number Diff line number Diff line change 1+ function exec ([string ]$_cmd ) {
2+ write-host - ForegroundColor DarkGray " >>> $_cmd $args "
3+ $ErrorActionPreference = ' Continue'
4+ & $_cmd @args
5+ $ErrorActionPreference = ' Stop'
6+ if ($LASTEXITCODE -ne 0 ) {
7+ write-error " Failed with exit code $LASTEXITCODE "
8+ exit 1
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments