Publishing automation for vcpkg x-add-version (#1649)

* Add azure-template2 to validate publishing multiple packages to vcpkg

* Update versions to avoid release conflict

* Add custom port naming logic

* fix changelogs

* compute path

* Add azure-core-cpp dependency back in

* package name in control file

* Add changes to support vcpkg x-add-version

* Add azure-sdk identity to commit

* Remove old conditions/comments and use -am for commit

* remove -c parameters

* Use --author

* git config local

* space

* work around HasChanges=false

* Bump versions for verification

* Bump versions, update portfile to use azure-template2-cpp ref

* Add PackageVersion

* Revert template2

* Finish reverting template2

* Revert "Finish reverting template2"

This reverts commit aa1461facbdb7ebd1e0ad2d90f8fe5a7c9db9473.

* Revert "Revert template2"

This reverts commit 3a91e82e01e2d1610da0747c2c84e24f52105625.

* Commit without setting user.name and user.email

* bump version

* git commands on same line

* Revert "Revert "Revert template2""

This reverts commit 1721a626e3c2e2b8c43dfe4a2fedf5a891c58793.

* Revert "Revert "Finish reverting template2""

This reverts commit 461a57c14aee97c9b6f83c79fe3a74122c890fb2.

* Finish reverting template2
This commit is contained in:
Daniel Jurek 2021-02-09 14:56:00 -08:00 committed by GitHub
parent cda5d62b83
commit 2d4d766c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 7 deletions

View File

@ -100,6 +100,24 @@ stages:
Write-Host "##vso[task.setvariable variable=PrBranchName]$branchName"
displayName: Set fork branch name
- pwsh: |
$packageSpec = Get-Content -Raw -Path "$(Pipeline.Workspace)/packages/${{artifact.Name}}/package-info.json" | ConvertFrom-Json
$version = $packageSpec.version
$title = "[${{ artifact.VcpkgPortName }}] publish version $version"
if ('$(VcpkgPRTitle)') {
Write-Host "Using queue time PR title"
$title = '$(VcpkgPRTitle)'
}
Write-Host "##vso[task.setvariable variable=PrTitle]$title"
displayName: Set PR title
- pwsh: |
$packageSpec = Get-Content -Raw -Path "$(Pipeline.Workspace)/packages/${{artifact.Name}}/package-info.json" | ConvertFrom-Json
$version = $packageSpec.version
Write-Host "##vso[task.setvariable variable=PackageVersion]$version"
displayName: Set PackageVersion variable
- task: Powershell@2
inputs:
filePath: eng/scripts/Initialize-VcpkgRelease.ps1
@ -139,21 +157,42 @@ stages:
Write-Host "git status"
git status
displayName: Copy updated files into vcpkg fork for PR
condition: ne(variables['SkipVcpkgUpdate'], 'true')
# This template does not need to check the
# SkipVcpkgUpdate variable, it will stop if there are no
# changes in the git repo.
# Commit changes
Write-Host "git add -A"
git add -A
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -m `"Initial vcpkg commit for ${{ artifact.VcpkgPortName }}`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit -m "Initial vcpkg commit for ${{ artifact.VcpkgPortName }}"
# Run vcpkg x-add-version to add version to vcpkg file
Write-Host "./bootstrap-vcpkg.bat"
./bootstrap-vcpkg.bat
Write-Host "./vcpkg.exe x-add-version ${{ artifact.VcpkgPortName }}"
./vcpkg.exe x-add-version ${{ artifact.VcpkgPortName }}
# Amend commit to include results of x-add-version
Write-Host "git status"
git status
Write-Host "git add -A"
git add -A
Write-Host "git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit --amend -m `"[${{ artifact.VcpkgPortName }}] Update to $(PackageVersion)`""
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" commit --amend -m "[${{ artifact.VcpkgPortName }}] Update to $(PackageVersion)"
# Work around create-pull-request.yml logic that
# checks for changes
Write-Host "##vso[task.setvariable variable=HasChanges]$true"
displayName: Commit changes for PR
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
RepoOwner: Microsoft
RepoName: vcpkg
WorkingDirectory: $(Pipeline.Workspace)/vcpkg
PrBranchName: $(PrBranchName)
CommitMsg: "Update port for ${{ artifact.VcpkgPortName }}"
PRTitle: "Update port for ${{ artifact.VcpkgPortName }}"
CommitMsg: "[${{ artifact.VcpkgPortName }}] Update to $(PackageVersion)"
PRTitle: $(PrTitle)
BaseBranchName: master
SkipCheckingForChanges: true
- ${{if ne(artifact.skipUpdatePackageVersion, 'true')}}:
- deployment: UpdatePackageVersion

View File

@ -3,6 +3,7 @@
#
Source: azure-template-cpp
Version: @AZ_LIBRARY_VERSION@
Build-Depends: azure-core-cpp
Description: Microsoft Azure Template SDK for C++
This is a template library meant to illustrate initial client library development process for Azure SDK.
It is not meant to be published to vcpkg.