@@ -9,9 +9,9 @@ permissions:
99 contents : write
1010
1111jobs :
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
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