Skip to content

Commit 8c43acd

Browse files
Fix release workflow: build and upload in single workflow
GITHUB_TOKEN events don't trigger other workflows, so the two-workflow chain (release creates tag → build uploads zips) never worked. Now the release workflow handles everything: create release, build, publish, zip, upload. CI workflow stays as just build+test for PRs/pushes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5df83bf commit 8c43acd

2 files changed

Lines changed: 53 additions & 52 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
name: Build
1+
name: CI
22

33
on:
44
push:
55
branches: [main]
66
pull_request:
77
branches: [main, dev]
8-
release:
9-
types: [published]
10-
11-
permissions:
12-
contents: write
138

149
jobs:
1510
build-and-test:
@@ -39,43 +34,3 @@ jobs:
3934
4035
- name: Run tests
4136
run: dotnet test tests/PlanViewer.Core.Tests/PlanViewer.Core.Tests.csproj -c Release --no-build --verbosity normal
42-
43-
- name: Publish App (all platforms)
44-
if: github.event_name == 'release'
45-
run: |
46-
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r win-x64 --self-contained -o publish/win-x64
47-
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r linux-x64 --self-contained -o publish/linux-x64
48-
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r osx-x64 --self-contained -o publish/osx-x64
49-
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r osx-arm64 --self-contained -o publish/osx-arm64
50-
51-
- name: Package release artifacts
52-
if: github.event_name == 'release'
53-
shell: pwsh
54-
run: |
55-
New-Item -ItemType Directory -Force -Path releases
56-
57-
$rids = @('win-x64', 'linux-x64', 'osx-x64', 'osx-arm64')
58-
foreach ($rid in $rids) {
59-
if (Test-Path 'README.md') { Copy-Item 'README.md' "publish/$rid/" }
60-
if (Test-Path 'LICENSE') { Copy-Item 'LICENSE' "publish/$rid/" }
61-
Compress-Archive -Path "publish/$rid/*" -DestinationPath "releases/PerformanceStudio-$rid.zip" -Force
62-
}
63-
64-
- name: Generate checksums
65-
if: github.event_name == 'release'
66-
shell: pwsh
67-
run: |
68-
$checksums = Get-ChildItem releases/*.zip | ForEach-Object {
69-
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
70-
"$hash $($_.Name)"
71-
}
72-
$checksums | Out-File -FilePath releases/SHA256SUMS.txt -Encoding utf8
73-
Write-Host "Checksums:"
74-
$checksums | ForEach-Object { Write-Host $_ }
75-
76-
- name: Upload release assets
77-
if: github.event_name == 'release'
78-
env:
79-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
run: |
81-
gh release upload ${{ github.event.release.tag_name }} releases/*.zip releases/SHA256SUMS.txt --clobber

.github/workflows/release.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
create-release:
12+
release:
1313
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'dev'
14-
runs-on: ubuntu-latest
14+
runs-on: windows-latest
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -39,7 +39,53 @@ jobs:
3939
env:
4040
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
run: |
42-
gh release create "v${{ steps.version.outputs.VERSION }}" \
43-
--title "v${{ steps.version.outputs.VERSION }}" \
44-
--generate-notes \
45-
--target main
42+
gh release create "v${{ steps.version.outputs.VERSION }}" --title "v${{ steps.version.outputs.VERSION }}" --generate-notes --target main
43+
44+
- name: Setup .NET 8.0
45+
if: steps.check.outputs.EXISTS == 'false'
46+
uses: actions/setup-dotnet@v4
47+
with:
48+
dotnet-version: 8.0.x
49+
50+
- name: Build and test
51+
if: steps.check.outputs.EXISTS == 'false'
52+
run: |
53+
dotnet restore
54+
dotnet build -c Release
55+
dotnet test tests/PlanViewer.Core.Tests/PlanViewer.Core.Tests.csproj -c Release --no-build --verbosity normal
56+
57+
- name: Publish App (all platforms)
58+
if: steps.check.outputs.EXISTS == 'false'
59+
run: |
60+
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r win-x64 --self-contained -o publish/win-x64
61+
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r linux-x64 --self-contained -o publish/linux-x64
62+
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r osx-x64 --self-contained -o publish/osx-x64
63+
dotnet publish src/PlanViewer.App/PlanViewer.App.csproj -c Release -r osx-arm64 --self-contained -o publish/osx-arm64
64+
65+
- name: Package and upload
66+
if: steps.check.outputs.EXISTS == 'false'
67+
shell: pwsh
68+
env:
69+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
VERSION: ${{ steps.version.outputs.VERSION }}
71+
run: |
72+
New-Item -ItemType Directory -Force -Path releases
73+
74+
$rids = @('win-x64', 'linux-x64', 'osx-x64', 'osx-arm64')
75+
foreach ($rid in $rids) {
76+
if (Test-Path 'README.md') { Copy-Item 'README.md' "publish/$rid/" }
77+
if (Test-Path 'LICENSE') { Copy-Item 'LICENSE' "publish/$rid/" }
78+
Compress-Archive -Path "publish/$rid/*" -DestinationPath "releases/PerformanceStudio-$rid.zip" -Force
79+
}
80+
81+
# Checksums
82+
$checksums = Get-ChildItem releases/*.zip | ForEach-Object {
83+
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
84+
"$hash $($_.Name)"
85+
}
86+
$checksums | Out-File -FilePath releases/SHA256SUMS.txt -Encoding utf8
87+
Write-Host "Checksums:"
88+
$checksums | ForEach-Object { Write-Host $_ }
89+
90+
# Upload
91+
gh release upload "v$env:VERSION" releases/*.zip releases/SHA256SUMS.txt --clobber

0 commit comments

Comments
 (0)