Skip to content

Commit 7ca1d83

Browse files
authored
ci: make dev-build PR description copy-paste ready (#1715)
1 parent dce87b2 commit 7ca1d83

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/publish-dev.yml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,53 @@ jobs:
109109
110110
Write-Output "Package $PROJECT_NAME version set to $DEV_VERSION"
111111
112+
# Shared dev suffix for every package built in this run (same PR + run number)
113+
$DEV_SUFFIX = "dev1$PADDED_PR$PADDED_RUN"
114+
115+
# Intra-repo dependencies per package. A dev build of these is < the package's
116+
# base version (PEP 440 pre-release), so it falls outside the published ">=base"
117+
# constraint and must be forced in via [tool.uv] override-dependencies.
118+
$internalDepsMap = @{
119+
"uipath" = @("uipath-platform", "uipath-core")
120+
"uipath-platform" = @("uipath-core")
121+
"uipath-core" = @()
122+
}
123+
124+
# Packages also published in this run (their dev builds exist on testpypi)
125+
$changedPackages = '${{ needs.detect-changed-packages.outputs.packages }}' | ConvertFrom-Json
126+
127+
$overrideDeps = @()
128+
foreach ($dep in $internalDepsMap[$PROJECT_NAME]) {
129+
if ($changedPackages -contains $dep) {
130+
$depPyproj = Get-Content "../$dep/pyproject.toml" -Raw
131+
$depBaseVersion = ($depPyproj | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
132+
$overrideDeps += [PSCustomObject]@{ Name = $dep; Version = "$depBaseVersion.$DEV_SUFFIX" }
133+
}
134+
}
135+
136+
# [tool.uv.sources]: the package itself plus every overridden dep point at testpypi
137+
$sourcesLines = @("$PROJECT_NAME = { index = `"testpypi`" }")
138+
foreach ($d in $overrideDeps) { $sourcesLines += "$($d.Name) = { index = `"testpypi`" }" }
139+
$sourcesBlock = $sourcesLines -join "`n"
140+
141+
# Optional [tool.uv] override block (omitted when no intra-repo dep was published)
142+
$overrideBlock = ""
143+
if ($overrideDeps.Count -gt 0) {
144+
$overrideItems = ($overrideDeps | ForEach-Object { "`"$($_.Name)==$($_.Version)`"" }) -join ", "
145+
$overrideBlock = "`n[tool.uv]`noverride-dependencies = [$overrideItems]`n"
146+
}
147+
112148
$dependencyMessage = @"
113149
### $PROJECT_NAME
114150
115151
``````toml
116152
[project]
117153
dependencies = [
118-
# Exact version:
154+
# Exact version (copy-paste ready):
119155
"$PROJECT_NAME==$DEV_VERSION",
120156
121-
# Any version from PR
122-
"$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION"
157+
# Any version from this PR (uncomment to use a range instead):
158+
# "$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION",
123159
]
124160
125161
[[tool.uv.index]]
@@ -129,8 +165,8 @@ jobs:
129165
explicit = true
130166
131167
[tool.uv.sources]
132-
$PROJECT_NAME = { index = "testpypi" }
133-
``````
168+
$sourcesBlock
169+
$overrideBlock``````
134170
"@
135171
136172
# Get the owner and repo from the GitHub repository

0 commit comments

Comments
 (0)