Skip to content

Commit f3e0603

Browse files
committed
Fix pipeline after worker refactor
1 parent 4a19d87 commit f3e0603

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

eng/templates/official/jobs/publish-release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ jobs:
88
os: linux
99
steps:
1010
- powershell: |
11+
$githubUser = "$(GithubUser)"
1112
$githubToken = "$(GithubPat)"
1213
$newLibraryVersion = "$(NewLibraryVersion)"
1314
1415
if($newLibraryVersion -match '(\d)+.(\d)+.(\d)+') {
1516
# Create GitHub credential
1617
git config --global user.name "AzureFunctionsPython"
1718
git config --global user.email "[email protected]"
19+
20+
# Create GitHub credential
21+
$credential = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${githubUser}:${githubToken}"))
1822
1923
# Heading to Artifact Repository
2024
Write-Host "Operating based on $stagingDirectory/azure-functions-python-library"
@@ -29,6 +33,21 @@ jobs:
2933
# Create release branch release/X.Y.Z
3034
Write-Host "Creating release branch release/$newLibraryVersion"
3135
git push --repo="https://[email protected]/Azure/azure-functions-python-library.git"
36+
37+
# Create PR
38+
Write-Host "Creating PR draft in GitHub"
39+
$body = (@{head="$newBranch";base="dev";body="Python SDK Version [$newLibraryVersion]";draft=$true;maintainer_can_modify=$true;title="build: update Python SDK Version to $newLibraryVersion"} | ConvertTo-Json -Compress)
40+
$response = Invoke-WebRequest -Headers @{"Cache-Control"="no-cache";"Content-Type"="application/json";"Authorization"="Basic $credential";"Accept"="application/vnd.github.v3+json"} -Method Post -Body "$body" -Uri "https://api.github.com/repos/Azure/azure-functions-python-library/pulls"
41+
42+
# Return Value
43+
if ($response.StatusCode -ne 201) {
44+
Write-Host "Failed to create PR in Azure Functions Python Library"
45+
exit -1
46+
}
47+
48+
$draftUrl = $response | ConvertFrom-Json | Select -expand url
49+
Write-Host "PR draft created in $draftUrl"
50+
3251
} else {
3352
Write-Host "NewLibraryVersion $newLibraryVersion is malformed (example: 1.5.0)"
3453
exit -1
@@ -144,11 +163,11 @@ jobs:
144163
145164
# Modify SDK Version in pyproject.toml
146165
Write-Host "Replacing SDK version in worker's pyproject.toml"
147-
((Get-Content pyproject.toml) -replace '"azure-functions==(\d)+.(\d)+.*"','"azure-functions==$(NewLibraryVersion)"' -join "`n") + "`n" | Set-Content -NoNewline pyproject.toml
148-
166+
((Get-Content workers/pyproject.toml) -replace '"azure-functions==(\d)+.(\d)+.*"','"azure-functions==$(NewLibraryVersion)"' -join "`n") + "`n" | Set-Content -NoNewline workers/pyproject.toml
167+
149168
# Commit Python Version
150169
Write-Host "Pushing $newBranch to azure-functions-python-worker repo"
151-
git add pyproject.toml
170+
git add workers/pyproject.toml
152171
git commit -m "Update Python SDK Version to $newLibraryVersion"
153172
git push origin $newBranch
154173

0 commit comments

Comments
 (0)