Skip to content
Browse files

Moved logic for publish github release around

  • Loading branch information...
lipkau committed Feb 21, 2019
1 parent 869c9fb commit 947628c55b58dfd8cc4acbdf889fb4f33cb88b39
Showing with 19 additions and 22 deletions.
  1. +12 −22
  2. +7 −0 Tools/BuildTools.psm1
@@ -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\$" -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\$"
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://$`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 `"`""
git config --global ""

Write-Build Gray "git config --global `"AtlassianPS automation`""
git config --global "AtlassianPS automation"

Write-Build Gray "git close .../ --recursive"
$null = cmd /c "git clone --recursive 2>&1"

@@ -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 ""
git config --global "AtlassianPS Automated User"
git config --global credential.helper "store --file ~/.git-credentials"

0 comments on commit 947628c

Please sign in to comment.
You can’t perform that action at this time.