@@ -16,57 +16,23 @@ using module "PSModules/RepoBuild/RepoBuild.psd1"
1616 This is used by automated release builds to essentially "commit" the doc changes before a dedicated step pushes the results.
1717#>
1818Param (
19- [switch ]$FullInit ,
20- [switch ]$SkipPush
19+ [switch ]$FullInit
2120)
2221
2322$buildInfo = Initialize-BuildEnvironment - FullInit:$FullInit
2423
25- Write-Information " Preparing to PUSH updated docs to GitHub IO "
24+ Write-Information " Preparing to commit updated docs for gh-pages "
2625
27- $canPush = $env: IsAutomatedBuild -and ($env: IsPullRequestBuild -ieq ' false' )
28- if (! $canPush )
26+ $canCommit = $env: IsAutomatedBuild -and ($env: IsPullRequestBuild -ieq ' false' )
27+ if (! $canCommit )
2928{
30- Write-Information " Skipping Docs PUSH as this is not an official build"
29+ Write-Information " Skipping Docs commit as this is not an official build"
3130 return ;
3231}
3332
34- # Docs must only be updated from a build with the official repository as the default remote.
35- # This ensures that the links to source in the generated docs will have the correct URLs
36- # (e.g. docs pushed to the official repository MUST not have links to source in some private fork)
37- $remoteUrl = Invoke-External git ls- remote -- get-url
38-
39- Write-Information " Remote URL: $remoteUrl "
40-
41- if ($remoteUrl -ne $buildInfo [' OfficialGitRemoteUrl' ])
42- {
43- throw " Pushing docs is only allowed when the origin remote is the official source - current remote is '$remoteUrl '"
44- }
45-
46- if (! $env: docspush_access_token -and ! $SkipPush )
47- {
48- Write-Error " Missing docspush_access_token" - ErrorAction Stop
49- }
50-
51- if (! $env: docspush_email )
52- {
53- Write-Error " Missing docspush_email" - ErrorAction Stop
54- }
55-
56- if (! $env: docspush_username )
57- {
58- Write-Error " Missing docspush_username" - ErrorAction Stop
59- }
60-
6133Push-Location .\BuildOutput\docs - ErrorAction Stop
6234try
6335{
64- if ($env: docspush_access_token )
65- {
66- Invoke-External git config -- local credential.helper store
67- Add-Content " $env: USERPROFILE \.git-credentials" " https://$ ( $env: docspush_access_token ) :x-oauth-basic@github.com`n "
68- }
69-
7036 Invoke-External git config -- local user.email " $env: docspush_email "
7137 Invoke-External git config -- local user.name " $env: docspush_username "
7238
8450 $msg = " CI Docs Update $ ( Get-BuildVersionTag $buildInfo ) "
8551 Write-Information " Committing changes to git [$msg ]"
8652 Invoke-External git commit - m" $msg "
87-
88- if (! $SkipPush )
89- {
90- Write-Information ' Pushing changes to git'
91- Invoke-External git push
92- }
9353}
9454catch
9555{
0 commit comments