Skip to content

Commit dd9835d

Browse files
check-version-bump: fall back to App.csproj when Directory.Build.props missing (#342)
Bootstrap fix for the v1.10.0 -> v1.11.0 release PR (#341). PR #315 (the version-unification refactor that introduced Directory.Build.props) landed on dev AFTER v1.10.0 was tagged, so main has never seen Directory.Build.props — the main-side checkout step fails on Get-Content with "Cannot find path". Test-Path now prefers Directory.Build.props and falls back to the legacy App.csproj location. Becomes dead code after #341 lands on main, but harmless and self-documenting. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2666163 commit dd9835d

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/check-version-bump.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ jobs:
1616
id: pr
1717
shell: pwsh
1818
run: |
19-
$version = ([xml](Get-Content src/Directory.Build.props)).Project.PropertyGroup.Version | Where-Object { $_ }
19+
# Prefer Directory.Build.props; fall back to App.csproj for branches that
20+
# predate the version-unification refactor (PR #315).
21+
$ddb = 'src/Directory.Build.props'
22+
$app = 'src/PlanViewer.App/PlanViewer.App.csproj'
23+
$path = if (Test-Path $ddb) { $ddb } else { $app }
24+
$version = ([xml](Get-Content $path)).Project.PropertyGroup.Version | Where-Object { $_ }
2025
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
21-
Write-Host "PR version: $version"
26+
Write-Host "PR version: $version (from $path)"
2227
2328
- name: Checkout main
2429
uses: actions/checkout@v5
@@ -30,9 +35,12 @@ jobs:
3035
id: main
3136
shell: pwsh
3237
run: |
33-
$version = ([xml](Get-Content main-branch/src/Directory.Build.props)).Project.PropertyGroup.Version | Where-Object { $_ }
38+
$ddb = 'main-branch/src/Directory.Build.props'
39+
$app = 'main-branch/src/PlanViewer.App/PlanViewer.App.csproj'
40+
$path = if (Test-Path $ddb) { $ddb } else { $app }
41+
$version = ([xml](Get-Content $path)).Project.PropertyGroup.Version | Where-Object { $_ }
3442
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
35-
Write-Host "Main version: $version"
43+
Write-Host "Main version: $version (from $path)"
3644
3745
- name: Compare versions
3846
env:
@@ -42,7 +50,7 @@ jobs:
4250
echo "Main version: $MAIN_VERSION"
4351
echo "PR version: $PR_VERSION"
4452
if [ "$PR_VERSION" == "$MAIN_VERSION" ]; then
45-
echo "::error::Version in PlanViewer.App.csproj ($PR_VERSION) has not changed from main. Bump the version before merging to main."
53+
echo "::error::Version ($PR_VERSION) has not changed from main. Bump the version before merging to main."
4654
exit 1
4755
fi
4856
echo "✅ Version bumped: $MAIN_VERSION → $PR_VERSION"

0 commit comments

Comments
 (0)