Skip to content

Commit b0d26be

Browse files
committed
ci: add dedicated publish job gated on build and build-unity
1 parent 4cfac5c commit b0d26be

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

.github/workflows/build-release.yaml

Lines changed: 25 additions & 13 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:
@@ -46,16 +45,6 @@ jobs:
4645
name: nuget
4746
path: ./publish/
4847
retention-days: 1
49-
# push nuget
50-
- name: NuGet login (OIDC)
51-
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
52-
id: login
53-
with:
54-
user: ${{ secrets.NUGET_USER }}
55-
- run: dotnet nuget push "./publish/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}"
56-
if: ${{ !inputs.dry-run }}
57-
env:
58-
NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
5948

6049
build-unity:
6150
needs: [update-packagejson]
@@ -107,9 +96,32 @@ jobs:
10796
path: ./src/UniTask/UniTask.${{ inputs.tag }}.unitypackage
10897
retention-days: 1
10998

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+
110122
# release
111123
create-release:
112-
needs: [update-packagejson, build-dotnet, build-unity]
124+
needs: [update-packagejson, publish]
113125
permissions:
114126
contents: write
115127
id-token: write # required for NuGet Trusted Publish
@@ -125,7 +137,7 @@ jobs:
125137

126138
cleanup:
127139
if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }}
128-
needs: [update-packagejson, build-dotnet, build-unity]
140+
needs: [update-packagejson, create-release]
129141
permissions:
130142
contents: write
131143
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main

0 commit comments

Comments
 (0)