Add pip bumpversion to setup.cfg and build-release.yaml (#134)
Add calls to bumpversion utility and supporting files for auto-maintained package versioning per sdk release.
This commit is contained in:
Родитель
54994fbb7e
Коммит
4275962321
|
@ -0,0 +1,7 @@
|
|||
[bumpversion]
|
||||
current_version = 2.0.0-preview.7
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)-preview\.(?P<preview>\d+)
|
||||
serialize = {major}.{minor}.{patch}-preview.{preview}
|
||||
|
||||
[bumpversion:part:preview]
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
[bumpversion]
|
||||
current_version = 1.0.1
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
|
||||
serialize = {major}.{minor}.{patch}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
$sourceFiles = $env:sources # sdk repo top folder
|
||||
$dist = $env:dist # release artifacts top folder
|
||||
|
||||
New-Item $dist -Force -ItemType Directory
|
||||
|
||||
pip install bumpversion
|
||||
pip install wheel
|
||||
|
||||
# hashset key is package folder name in repo
|
||||
|
||||
$packages = @{ }
|
||||
$packages["azure-iot-device"] = $env:device_version_part
|
||||
$packages["azure-iot-nspkg"] = $env:nspkg_version_part
|
||||
|
||||
foreach ($key in $packages.Keys) {
|
||||
|
||||
$part = $packages[$key]
|
||||
|
||||
Write-Host "package '$key' version '$part'"
|
||||
|
||||
if ($part -ne "") {
|
||||
Write-Host "version part: $part"
|
||||
|
||||
$packageFolder = $(Join-Path $sourceFiles $key)
|
||||
|
||||
Write-Host "package folder: $packageFolder"
|
||||
|
||||
Set-Location $packageFolder
|
||||
bumpversion.exe $part --config-file .\.bumpverion.cfg --allow-dirty .\setup.py
|
||||
|
||||
python setup.py sdist
|
||||
python setup.py bdist_wheel
|
||||
|
||||
$distfld = Join-Path $packageFolder "dist"
|
||||
$files = Get-ChildItem $distfld
|
||||
|
||||
if ($files.Count -lt 1) {
|
||||
throw "$key : expected to find release artifacts"
|
||||
}
|
||||
|
||||
$packagefld = Join-Path $dist $key
|
||||
New-Item $packagefld -Force -ItemType Directory
|
||||
|
||||
foreach ($file in $files) {
|
||||
Copy-Item $file.FullName $(Join-Path $packagefld $file.Name)
|
||||
}
|
||||
} else {
|
||||
Write-Host "no version bump for package '$key'"
|
||||
}
|
||||
}
|
|
@ -1,18 +1,16 @@
|
|||
name: ReleaseBuild_$(BuildID)_$(Date:yyyyMMdd)$(Rev:.r)
|
||||
|
||||
trigger: none
|
||||
|
||||
steps:
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
inputs:
|
||||
buildType: 'specific'
|
||||
project: 'f9b79625-2860-4d92-a4ee-57b03fabfd10'
|
||||
pipeline: '311'
|
||||
project: 'f9b79625-2860-4d92-a4ee-57b03fabfd10' # azure-iot-sdks
|
||||
pipeline: '296' # iot-sdks-internal-mirror pipeline
|
||||
buildVersionToDownload: 'latest'
|
||||
downloadType: 'single'
|
||||
downloadPath: '$(System.ArtifactsDirectory)/scripts'
|
||||
artifactName: 'python'
|
||||
downloadPath: $(System.ArtifactsDirectory)\internal
|
||||
artifactName: 'python' # script (azure-iot-sdk-bump-version.ps1) location
|
||||
|
||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
||||
persistCredentials: 'true' # set to 'true' to leave the OAuth token in the Git config after the initial fetch
|
||||
|
@ -21,32 +19,36 @@ steps:
|
|||
- task: UsePythonVersion@0
|
||||
displayName: 'Use Python 3.x'
|
||||
|
||||
- task: PowerShell@2
|
||||
inputs:
|
||||
filePath: $(Build.SourcesDirectory)\vsts\build-release.ps1
|
||||
env:
|
||||
dist: $(System.ArtifactsDirectory)\dist
|
||||
sources: $(Build.SourcesDirectory)
|
||||
device_version_part: $(azure-iot-device-version-part)
|
||||
nspkg_version_part: $(azure-iot-nspkg-version-part)
|
||||
displayName: 'build release artifacts'
|
||||
|
||||
- task: PowerShell@2
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
. $(System.ArtifactsDirectory)/scripts/python/azure-iot-sdk-bump-version.ps1
|
||||
Update-PythonVersions
|
||||
. $(System.ArtifactsDirectory)\internal\python\azure-iot-sdk-bump-version.ps1
|
||||
Publish-Branch $env:githubname $env:githubemail $env:tagname $env:sources
|
||||
env:
|
||||
sources: $(Build.SourcesDirectory)
|
||||
githubemail: aziotclb@microsoft.com
|
||||
githubname: 'Azure IoT Client Build'
|
||||
tagname: $(tagname)
|
||||
|
||||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
pip install wheel
|
||||
cd %sources%\azure-iot-device
|
||||
python setup.py sdist
|
||||
python setup.py bdist_wheel
|
||||
env:
|
||||
sources: $(Build.SourcesDirectory)
|
||||
enabled: 'true'
|
||||
displayName: 'create GitHub.com release branch'
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifacts'
|
||||
displayName: 'publish release artifacts'
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.SourcesDirectory)/azure-iot-device/dist'
|
||||
PathtoPublish: $(System.ArtifactsDirectory)\dist
|
||||
ArtifactName: 'dist'
|
||||
publishLocation: 'Container'
|
||||
enabled: 'true'
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче