From 8d369e3ef92632c742bc78e531c02916a381dfba Mon Sep 17 00:00:00 2001 From: Nate Ferrell Date: Fri, 20 Mar 2020 01:58:31 -0500 Subject: [PATCH] moved deployment tweet to before the GitHub Release section --- psake.ps1 | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/psake.ps1 b/psake.ps1 index 876d3ec1..eb168b3c 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -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") @@ -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