Skip to content

Commit

Permalink
Publishing automation for vcpkg x-add-version (#1649)
Browse files Browse the repository at this point in the history
* 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 aa1461f.

* Revert "Revert template2"

This reverts commit 3a91e82.

* Commit without setting user.name and user.email

* bump version

* git commands on same line

* Revert "Revert "Revert template2""

This reverts commit 1721a62.

* Revert "Revert "Finish reverting template2""

This reverts commit 461a57c.

* Finish reverting template2
  • Loading branch information
danieljurek authored Feb 9, 2021
1 parent cda5d62 commit 2d4d766
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
53 changes: 46 additions & 7 deletions eng/pipelines/templates/stages/archetype-cpp-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=`"[email protected]`" commit -m `"Initial vcpkg commit for ${{ artifact.VcpkgPortName }}`""
git -c user.name="azure-sdk" -c user.email="[email protected]" 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=`"[email protected]`" commit --amend -m `"[${{ artifact.VcpkgPortName }}] Update to $(PackageVersion)`""
git -c user.name="azure-sdk" -c user.email="[email protected]" 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
Expand Down
1 change: 1 addition & 0 deletions sdk/template/azure-template/vcpkg/CONTROL
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2d4d766

Please sign in to comment.