-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved logic for publish github release around
- Loading branch information
Showing
2 changed files
with
19 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,43 +256,33 @@ task PublishToGallery { | |
|
||
# Synopsis: push a tag with the version to the git repository | ||
task TagReplository GetNextVersion, Package, { | ||
Assert-True (-not [String]::IsNullOrEmpty($GithubAccessToken)) "No key for the PSGallery" | ||
|
||
$releaseText = "Release version $env:NextBuildVersion" | ||
|
||
# Push a tag to the repository | ||
Write-Build Gray "git checkout $ENV:BHBranchName" | ||
cmd /c "git checkout $ENV:BHBranchName 2>&1" | ||
|
||
Write-Build Gray "git tag -a v$env:NextBuildVersion" | ||
cmd /c "git tag -a v$env:NextBuildVersion 2>&1 -m `"$releaseText`"" | ||
Write-Build Gray "git tag -a v$env:NextBuildVersion -m `"$releaseText`"" | ||
cmd /c "git tag -a v$env:NextBuildVersion -m `"$releaseText`" 2>&1" | ||
|
||
Write-Build Gray "git push origin v$env:NextBuildVersion" | ||
cmd /c "git push origin v$env:NextBuildVersion 2>&1" | ||
|
||
# Publish a release on github for the tag above | ||
$releaseResponse = Publish-GithubRelease -GITHUB_ACCESS_TOKEN $GithubAccessToken -ReleaseText $releaseText -NextBuildVersion $env:NextBuildVersion | ||
|
||
# Upload the package of the version to the release | ||
$packageFile = Get-Item "$env:BHBuildOutput\$env:BHProjectName.zip" -ErrorAction Stop | ||
$uploadURI = $releaseResponse.upload_url -replace "\{\?name,label\}", "?name=$($packageFile.Name)" | ||
$null = Publish-GithubReleaseArtifact -GITHUB_ACCESS_TOKEN $GithubAccessToken -Uri $uploadURI -Path $packageFile | ||
Write-Build Gray "Publish v$env:NextBuildVersion as a GitHub release" | ||
$release = @{ | ||
AccessToken = $GithubAccessToken | ||
TagName = "v$env:NextBuildVersion" | ||
Name = "Version $env:NextBuildVersion" | ||
ReleaseText = $releaseText | ||
RepositoryOwner = "AtlassianPS" | ||
Artifact = "$env:BHBuildOutput\$env:BHProjectName.zip" | ||
} | ||
Publish-GithubRelease @release | ||
} | ||
|
||
# Synopsis: Update the version of this module that the homepage uses | ||
task UpdateHomepage { | ||
try { | ||
Add-Content (Join-Path $Home ".git-credentials") "https://$GithubAccessToken:x[email protected]`n" | ||
|
||
Write-Build Gray "git config --global credential.helper `"store --file ~/.git-credentials`"" | ||
git config --global credential.helper "store --file ~/.git-credentials" | ||
|
||
Write-Build Gray "git config --global user.email `"[email protected]`"" | ||
git config --global user.email "[email protected]" | ||
|
||
Write-Build Gray "git config --global user.name `"AtlassianPS automation`"" | ||
git config --global user.name "AtlassianPS automation" | ||
|
||
Write-Build Gray "git close .../AtlassianPS.github.io --recursive" | ||
$null = cmd /c "git clone https://github.com/AtlassianPS/AtlassianPS.github.io --recursive 2>&1" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,13 @@ function Invoke-Init { | |
begin { | ||
Set-BuildEnvironment -BuildOutput '$ProjectPath/Release' -ErrorAction SilentlyContinue | ||
Add-ToModulePath -Path $env:BHBuildOutput | ||
|
||
# github's PAT is stored to ~\.git-credentials within the Release Pipeline | ||
# to avoid it being passed as parameter | ||
|
||
git config --global user.email "[email protected]" | ||
git config --global user.name "AtlassianPS Automated User" | ||
git config --global credential.helper "store --file ~/.git-credentials" | ||
} | ||
} | ||
|
||
|