Skip to content

Commit 037477c

Browse files
committed
ci(workflow): release.yml
update release pipeline to provide runtime-specific dotnet tool NuGet publishing
1 parent 2720eea commit 037477c

1 file changed

Lines changed: 54 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ jobs:
7171
with:
7272
versionSpec: '0.20.x'
7373
- name: Publish
74-
run: |
75-
mkdir output
76-
dotnet publish ./src/HydraScript/HydraScript.csproj -r ${{ matrix.config.rid }} -p:Version=${{ needs.create-release.outputs.publish_version }} -o ./output
74+
run: >-
75+
dotnet publish ./src/HydraScript/HydraScript.csproj
76+
-r ${{ matrix.config.rid }}
77+
-p:Version=${{ needs.create-release.outputs.publish_version }}
78+
-o ./output
7779
- name: Rename Executable
78-
run: mv ./output/HydraScript${{ matrix.config.rid == 'win-x64' && '.exe' || '' }} ./output/hydrascript_${{ matrix.config.rid }}${{ matrix.config.rid == 'win-x64' && '.exe' || '' }}
80+
run: >-
81+
mv ./output/HydraScript${{ matrix.config.rid == 'win-x64' && '.exe' || '' }}
82+
./output/hydrascript_${{ matrix.config.rid }}${{ matrix.config.rid == 'win-x64' && '.exe' || '' }}
7983
- name: Add asset to a release with GitReleaseManager
8084
uses: gittools/actions/gitreleasemanager/addasset@v4.5.0
8185
with:
@@ -121,16 +125,56 @@ jobs:
121125
uses: actions/setup-dotnet@v5
122126
with:
123127
dotnet-version: 10.0.x
124-
- name: Build
125-
run: dotnet build ./src/HydraScript/HydraScript.csproj -c Release -v n `
126-
-p:Version=${{ needs.publish-release.outputs.publish_version }} `
127-
-p:PublishAot=false -p:PublishSingleFile=false
128+
- name: Pack
129+
run: >-
130+
dotnet pack ./src/HydraScript/HydraScript.csproj -c Release -o ./pack-output -v n
131+
-p:Version=${{ needs.publish-release.outputs.publish_version }}
132+
-p:PublishAot=false
133+
- name: NuGet login (OIDC → temp API key)
134+
uses: NuGet/login@v1
135+
id: nuget_login
136+
with:
137+
user: ${{ secrets.NUGET_USER }}
138+
- name: Publish
139+
run: >-
140+
dotnet nuget push ./pack-output/HydraScript.${{ needs.publish-release.outputs.publish_version }}.nupkg
141+
--api-key ${{ steps.nuget_login.outputs.NUGET_API_KEY }}
142+
--source "https://api.nuget.org/v3/index.json"
143+
144+
publish-rid-nuget:
145+
name: Publish as runtime-specific dotnet tool to NuGet
146+
needs: publish-release
147+
strategy:
148+
matrix:
149+
config:
150+
- os: ubuntu-latest
151+
rid: linux-x64
152+
- os: macos-latest
153+
rid: osx-arm64
154+
- os: windows-latest
155+
rid: win-x64
156+
runs-on: ${{ matrix.config.os }}
157+
steps:
158+
- name: Checkout
159+
uses: actions/checkout@v6
160+
- name: Setup .NET
161+
uses: actions/setup-dotnet@v5
162+
with:
163+
dotnet-version: 10.0.x
164+
- name: Pack
165+
run: >-
166+
dotnet pack ./src/HydraScript/HydraScript.csproj
167+
-c Release -o ./pack-rid-output -v n
168+
-r ${{ matrix.config.rid }}
169+
-p:Version=${{ needs.publish-release.outputs.publish_version }}
128170
- name: NuGet login (OIDC → temp API key)
129171
uses: NuGet/login@v1
130172
id: nuget_login
131173
with:
132174
user: ${{ secrets.NUGET_USER }}
133175
- name: Publish
134-
run: dotnet nuget push (ls "./src/HydraScript/bin/Release/*.nupkg") `
135-
--api-key ${{ steps.nuget_login.outputs.NUGET_API_KEY }} `
176+
run: >-
177+
dotnet nuget push
178+
./pack-rid-output/HydraScript.${{ needs.publish-release.outputs.publish_version }}.${{ matrix.config.rid }}.nupkg
179+
--api-key ${{ steps.nuget_login.outputs.NUGET_API_KEY }}
136180
--source "https://api.nuget.org/v3/index.json"

0 commit comments

Comments
 (0)