Skip to content

Commit

Permalink
moved deployment tweet to before the GitHub Release section
Browse files Browse the repository at this point in the history
  • Loading branch information
scrthq committed Mar 20, 2020
1 parent 235f2df commit 8d369e3
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,24 @@ $deployScriptBlock = {
" [SKIPPED] Deployment of version [$($versionToDeploy)] to PSGallery"
}
$commitId = git rev-parse --verify HEAD
if ($ENV:BHBuildSystem -eq 'VSTS' -and -not [String]::IsNullOrEmpty($env:TwitterAccessSecret) -and -not [String]::IsNullOrEmpty($env:TwitterAccessToken) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerKey) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerSecret)) {
" Publishing tweet about new release..."
$manifest = Import-PowerShellDataFile -Path (Join-Path $outputModVerDir "$($env:BHProjectName).psd1")
$text = "#$($env:BHProjectName) v$($versionToDeploy) is now available on the #PSGallery! https://www.powershellgallery.com/packages/$($env:BHProjectName)/$($versionToDeploy) #PowerShell"
$manifest.PrivateData.PSData.Tags | Foreach-Object {
$text += " #$($_)"
}
if ($text.Length -gt 280) {
" Trimming [$($text.Length - 280)] extra characters from tweet text to get to 280 character limit..."
$text = $text.Substring(0,280)
}
" Tweet text: $text"
Publish-Tweet -Tweet $text -ConsumerKey $env:TwitterConsumerKey -ConsumerSecret $env:TwitterConsumerSecret -AccessToken $env:TwitterAccessToken -AccessSecret $env:TwitterAccessSecret
" Tweet successful!"
}
else {
" [SKIPPED] Twitter update of new release"
}
if (-not [String]::IsNullOrEmpty($env:GitHubPAT)) {
" Creating Release ZIP..."
$zipPath = [System.IO.Path]::Combine($PSScriptRoot,"$($env:BHProjectName).zip")
Expand Down Expand Up @@ -567,24 +585,6 @@ $deployScriptBlock = {
else {
" [SKIPPED] Publishing Release v$($versionToDeploy) @ commit Id [$($commitId)] to GitHub"
}
if ($ENV:BHBuildSystem -eq 'VSTS' -and -not [String]::IsNullOrEmpty($env:TwitterAccessSecret) -and -not [String]::IsNullOrEmpty($env:TwitterAccessToken) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerKey) -and -not [String]::IsNullOrEmpty($env:TwitterConsumerSecret)) {
" Publishing tweet about new release..."
$manifest = Import-PowerShellDataFile -Path (Join-Path $outputModVerDir "$($env:BHProjectName).psd1")
$text = "#$($env:BHProjectName) v$($versionToDeploy) is now available on the #PSGallery! https://www.powershellgallery.com/packages/$($env:BHProjectName)/$($versionToDeploy) #PowerShell"
$manifest.PrivateData.PSData.Tags | Foreach-Object {
$text += " #$($_)"
}
if ($text.Length -gt 280) {
" Trimming [$($text.Length - 280)] extra characters from tweet text to get to 280 character limit..."
$text = $text.Substring(0,280)
}
" Tweet text: $text"
Publish-Tweet -Tweet $text -ConsumerKey $env:TwitterConsumerKey -ConsumerSecret $env:TwitterConsumerSecret -AccessToken $env:TwitterAccessToken -AccessSecret $env:TwitterAccessSecret
" Tweet successful!"
}
else {
" [SKIPPED] Twitter update of new release"
}
}
catch {
Write-Error $_ -ErrorAction Stop
Expand Down

0 comments on commit 8d369e3

Please sign in to comment.