* Tool changes to support nightly test package release * Initial wiring up and refactor vcpkg-publish.yml * Use vcpkg-clone.yml * Disable publishing for verification of nightly builds * Complete the comment * Dependency is enforced at the stage level, not the deployment/job level * Remove environment, no approval needed * Add ability to enable test release parameters * deploy -> job * deployment -> job * Remove strategy * Download pipeline artifacts * task -> download * Set appropriate working directory * git status * Set working directory * Add pipeline for nightly vcpkg PR update * Correct vcpkg-clone.yml path * Add identity parameters to git merge commands * Remove GitIdentityParameters, the merge command does not suppor tthem. Add instead in the pipeline * Split lines * Write-Host * Template for nightly branch name, update comments, Check for scheduling or "PublishNightlyVcpkg" * include archetype-cpp-release.yml changes * Re-enable publishing stage * Close the and * Runtime condition for integration stage * Move integration below package publishing stages * try -- to disambiguate * ^ -> ~ * Remove -- * Documentation and variable naming * Move documentation comment * Update eng/pipelines/templates/steps/generate-nightly-branch-name.yml Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> * Review feedback * Add ability to skip all release steps * Equal sign * The right number of dashes * Checkout before merge * Checkout the default branch * --no-ff * git reset * Skip publishing for artifacts which are not publishign to vcpkg * Add git config --unset * Apply suggestions from code review Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> * Review feedback * Review feedback * Remove extra reset * TestRelease -> DailyRelease Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
76 lines
2.4 KiB
PowerShell
76 lines
2.4 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Downloads the release asset and mutates the portfile.cmake file to use the
|
|
SHA512 hash of the release asset.
|
|
|
|
.PARAMETER SourceDirectory
|
|
Location of vcpkg assets (usually `<artifact-path>/packages/<package-name>/vcpkg`)
|
|
|
|
.PARAMETER PackageSpecPath
|
|
Location of the relevant package-info.json file
|
|
|
|
.PARAMETER GitHubRepo
|
|
Name of the GitHub repo (of the form Azure/azure-sdk-for-cpp)
|
|
|
|
.PARAMETER DailyReleaseRef
|
|
If supplied update the portfile.cmake file's REF and SHA512 with values
|
|
associated with the given ref.
|
|
|
|
#>
|
|
[CmdletBinding()]
|
|
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string] $SourceDirectory,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string] $PackageSpecPath,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string] $GitHubRepo,
|
|
|
|
[string] $DailyReleaseRef
|
|
)
|
|
|
|
# If there's nothing in the "port" folder to upload set SkipVcpkgUpdate to true
|
|
# and exit. Other steps will check SkipVcpkgUpdate to decide whether to move
|
|
# forward.
|
|
if (!(Get-ChildItem -Path "$SourceDirectory/port/CONTROL")) {
|
|
Write-Host "###vso[task.setvariable variable=SkipVcpkgUpdate]true"
|
|
exit
|
|
}
|
|
|
|
$packageSpec = Get-Content -Raw -Path $PackageSpecPath | ConvertFrom-Json
|
|
$tarGzUri = "https://github.com/$GitHubRepo/archive/$($packageSpec.packageName).tar.gz"
|
|
|
|
if ($DailyReleaseRef) {
|
|
Write-Verbose "Initializing Daily Release"
|
|
$tarGzUri = "https://github.com/$GitHubRepo/archive/$DailyReleaseRef.tar.gz"
|
|
}
|
|
|
|
Write-Host "Downloading tarball to compute hash from $tarGzUri"
|
|
$localTarGzPath = New-TemporaryFile
|
|
Invoke-WebRequest -Uri $tarGzUri -OutFile $localTarGzPath
|
|
|
|
$sha512 = (Get-FileHash -Path $localTarGzPath -Algorithm SHA512).Hash.ToLower()
|
|
Write-Host "SHA512: $sha512"
|
|
|
|
Write-Verbose "Writing the SHA512 hash"
|
|
$portfileLocation = "$SourceDirectory/port/portfile.cmake"
|
|
|
|
# Regex replace SHA512 preserving spaces. The placeholder "SHA512 1" is
|
|
# recommended in vcpkg documentation
|
|
# Before: " SHA512 1"
|
|
# After: " SHA512 f6cf1c16c52"
|
|
$portFileContent = Get-Content -Raw -Path $portfileLocation
|
|
$newContent = $portFileContent -replace '(SHA512\s+)1', "`${1}$sha512"
|
|
|
|
if ($DailyReleaseRef) {
|
|
Write-Verbose "Overriding REF with test release ref: $DailyReleaseRef"
|
|
$newContent = $newContent -replace '(?m)^(\s+)REF azure.*$', "`${1}REF $DailyReleaseRef"
|
|
}
|
|
|
|
$newContent | Set-Content $portfileLocation -NoNewLine
|