Skip to content

Commit eaea2cb

Browse files
committed
release: decouple .NET tool
Move deployment of .NET tool to nuget.org out of release workflow. With these changes, the .NET tool is published only after a release has been published (rather than with the creation of the release). This emulates what we currently do with Homebrew and ensures we only release the .NET tool when we are confident enough in a release's stability to publish it.
1 parent 0a16b0e commit eaea2cb

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: release-dotnet-tool
2+
on:
3+
release:
4+
types: [released]
5+
6+
jobs:
7+
release:
8+
runs-on: windows-latest
9+
environment: release
10+
steps:
11+
- name: Download NuGet package from release and publish
12+
run: |
13+
# Get asset information
14+
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
15+
$asset = $github.release.assets | Where-Object -Property name -match '.nupkg$'
16+
17+
# Download asset
18+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $asset.name
19+
20+
# Publish asset
21+
dotnet nuget push $asset.name --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
22+
shell: powershell

.github/workflows/release.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,3 @@ jobs:
791791
// Upload .NET tool package
792792
uploadDirectoryToRelease('dotnet-tool-sign'),
793793
]);
794-
795-
- name: Publish .NET tool to nuget.org
796-
run: |
797-
dotnet nuget push dotnet-tool-sign/*.nupkg \
798-
--api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)