@@ -5,14 +5,14 @@ name: .NET CI/CD
55
66on :
77 push :
8- branches : [ "main" ]
8+ branches : [ "main", "pre-release/upstream" ]
99
1010jobs :
1111 build-and-release :
1212 runs-on : windows-latest
1313 permissions :
14- contents : write
15- packages : write
14+ contents : write
15+ packages : read
1616 steps :
1717 - name : Checkout
1818 uses : actions/checkout@v4
3333 id : gitversion
3434 uses : gittools/actions/gitversion/execute@v1
3535
36+ - name : Select GitHub Packages token
37+ id : package_token
38+ shell : pwsh
39+ env :
40+ OTAPI_PACKAGES_READ_TOKEN : ${{ secrets.OTAPI_PACKAGES_READ_TOKEN }}
41+ GITHUB_TOKEN_FALLBACK : ${{ secrets.GITHUB_TOKEN }}
42+ run : |
43+ if ([string]::IsNullOrWhiteSpace($env:OTAPI_PACKAGES_READ_TOKEN)) {
44+ "token=$env:GITHUB_TOKEN_FALLBACK" >> $env:GITHUB_OUTPUT
45+ "token_source=GITHUB_TOKEN" >> $env:GITHUB_OUTPUT
46+ } else {
47+ "token=$env:OTAPI_PACKAGES_READ_TOKEN" >> $env:GITHUB_OUTPUT
48+ "token_source=OTAPI_PACKAGES_READ_TOKEN" >> $env:GITHUB_OUTPUT
49+ }
50+
51+ - name : Authenticate GitHub Packages source
52+ shell : pwsh
53+ run : |
54+ dotnet nuget update source github-cedarycat `
55+ --source "https://nuget.pkg.github.com/CedaryCat/index.json" `
56+ --username "${{ github.actor }}" `
57+ --password "${{ steps.package_token.outputs.token }}" `
58+ --store-password-in-clear-text `
59+ --configfile NuGet.config
60+
3661 - name : Restore dependencies
37- run : dotnet restore src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj
62+ shell : pwsh
63+ run : |
64+ dotnet restore src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj --configfile NuGet.config
65+ if ($LASTEXITCODE -ne 0) {
66+ Write-Host "::error::Restore failed. Check CedaryCat/otapi-packaging package visibility, package Actions access, and token scopes (read:packages)."
67+ exit $LASTEXITCODE
68+ }
3869
3970 - name : Build project with version
4071 run : >
6798 tag_name : v${{ steps.gitversion.outputs.nuGetVersionV2 }}
6899 release_name : Release v${{ steps.gitversion.outputs.nuGetVersionV2 }}
69100 draft : false
70- prerelease : false
101+ prerelease : ${{ github.ref == 'refs/heads/pre-release/upstream' }}
71102
72103 - name : Upload Release Asset
73104 uses : actions/upload-release-asset@v1
77108 upload_url : ${{ steps.create_release.outputs.upload_url }}
78109 asset_path : ./UnifiedServerProcess-v${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip
79110 asset_name : UnifiedServerProcess-v${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip
80- asset_content_type : application/zip
111+ asset_content_type : application/zip
0 commit comments