Skip to content

Commit 1cff934

Browse files
committed
ci: add dedicated publish job gated on build and build-unity
1 parent 1d462a1 commit 1cff934

1 file changed

Lines changed: 29 additions & 17 deletions

File tree

.github/workflows/build-release.yaml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
needs: [update-packagejson]
2828
permissions:
2929
contents: read
30-
id-token: write # required for NuGet Trusted Publish
3130
runs-on: ubuntu-24.04
3231
timeout-minutes: 10
3332
steps:
@@ -45,20 +44,6 @@ jobs:
4544
name: nuget
4645
path: ./publish
4746
retention-days: 1
48-
# push nuget
49-
- name: NuGet login (OIDC)
50-
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
51-
id: login
52-
with:
53-
user: ${{ secrets.NUGET_USER }}
54-
- run: dotnet nuget push "./publish/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
55-
if: ${{ !inputs.dry-run }}
56-
env:
57-
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
58-
- run: dotnet nuget push "./publish/*.snupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
59-
if: ${{ !inputs.dry-run }}
60-
env:
61-
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
6247

6348
build-unity:
6449
needs: [update-packagejson]
@@ -111,9 +96,36 @@ jobs:
11196
path: ./src/RandomFixtureKit.Unity/RandomFixtureKit.${{ inputs.tag }}.unitypackage
11297
retention-days: 1
11398

99+
# publish
100+
publish:
101+
name: "Publish NuGet packages"
102+
needs: [build-dotnet, build-unity]
103+
permissions:
104+
contents: read
105+
id-token: write # required for NuGet Trusted Publish
106+
runs-on: ubuntu-24.04
107+
timeout-minutes: 10
108+
steps:
109+
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
110+
- uses: Cysharp/Actions/.github/actions/download-artifact@main
111+
# push nuget
112+
- name: NuGet login (OIDC)
113+
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
114+
id: login
115+
with:
116+
user: ${{ secrets.NUGET_USER }}
117+
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
118+
if: ${{ !inputs.dry-run }}
119+
env:
120+
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
121+
- run: dotnet nuget push "./nuget/*.snupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
122+
if: ${{ !inputs.dry-run }}
123+
env:
124+
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
125+
114126
# release
115127
create-release:
116-
needs: [update-packagejson, build-dotnet, build-unity]
128+
needs: [update-packagejson, publish]
117129
permissions:
118130
contents: write
119131
id-token: write # required for NuGet Trusted Publish
@@ -129,7 +141,7 @@ jobs:
129141

130142
cleanup:
131143
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
132-
needs: [update-packagejson, build-unity]
144+
needs: [update-packagejson, create-release]
133145
permissions:
134146
contents: write
135147
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main

0 commit comments

Comments
 (0)