-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed deploy.yml to build.yml, added the amazing pwsh function @jam…
…essimone created for apex-rollup to auto-promote any prod package versions that are listed in README files
- Loading branch information
Showing
2 changed files
with
51 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This script finds any production install links for packages within README files & automatically promotes them | ||
|
||
$DebugPreference = 'Continue' | ||
$ErrorActionPreference = 'Stop' | ||
|
||
function Start-Package-Promotion { | ||
Write-Debug "Beginning promote script" | ||
|
||
$allReadmes = Get-ChildItem -Exclude node_modules, .sfdx, tests | Get-ChildItem -Filter README.md -Recurse | ||
foreach ($readme in $allReadmes) { | ||
$readmePackageIdResults = (Select-String -Path $readme 'https:\/\/login.salesforce.com\/packaging\/installPackage.apexp\?p0=.{0,18}') | ||
if ($readmePackageIdResults.Matches.Length -gt 0) { | ||
$packageIdSplit = $readmePackageIdResults.Matches[0].Value.Split("=") | ||
if ($packageIdSplit.Length -eq 2) { | ||
$packageId = $packageIdSplit[1] | ||
Write-Debug "Promoting $packageId from $readme" | ||
npx sfdx force:package:version:promote --package $packageId --noprompt | ||
} | ||
} | ||
} | ||
Write-Debug "Finished package promotion!" | ||
} | ||
|
||
Start-Package-Promotion |