1- name : Create a (Pre)release on NuGet
1+ name : Release to NuGet
22
33on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : ' Version (e.g., 1.2.3)'
8+ required : true
49 push :
510 tags :
6- - " v[0-9]+.[0-9]+.[0-9]+"
7- - " v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"
11+ - " v[0-9]+.[0-9]+.[0-9]+"
12+ - " v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"
13+
14+ permissions :
15+ contents : read
16+ packages : write
17+ id-token : write
18+
819jobs :
920 release-nuget :
10-
21+
1122 runs-on : windows-latest
1223
1324 steps :
@@ -21,27 +32,30 @@ jobs:
2132 - name : Install .NET MAUI Workload
2233 run : dotnet workload restore src\Plugin.Maui.Audio.sln
2334
24- - name : Verify commit exists in origin/main
25- run : |
26- git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
27- git branch --remote --contains | grep origin/main
35+ - name : Restore dependencies
36+ run : dotnet restore src\Plugin.Maui.Audio.sln
2837
29- - name : Get version information from tag
30- id : get_version
38+ - name : Pack
3139 run : |
32- $version="${{github.ref_name}}".TrimStart("v")
33- "version-without-v=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
40+ $tagOrInput = "${{ inputs.version != '' && inputs.version || github.ref_name }}"
41+ $version = $tagOrInput.TrimStart("v")
42+ dotnet pack src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -c Release -p:PackageVersion=$version -o artifacts
3443
35- - name : Restore dependencies
36- run : dotnet restore src\Plugin.Maui.Audio.sln
44+ - name : Upload artifacts
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : nuget
48+ path : artifacts\*.nupkg
3749
38- - name : Build
39- run : dotnet build src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -c Release /p:Version=${{ steps.get_version.outputs.version-without-v }}
50+ - name : NuGet login (OIDC)
51+ uses : nuget/login@v1
52+ id : nuget-login
53+ with :
54+ user : jfversluis
4055
41- - name : Pack
42- run : dotnet pack src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -c Release /p:Version=${{ steps.get_version.outputs.version-without-v }} --no-build --output .
43-
44- - name : Push
45- run : dotnet nuget push Plugin.Maui.Audio.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
46- env :
47- GITHUB_TOKEN : ${{ secrets.NUGET_API_KEY }}
56+ - name : Push to NuGet
57+ run : |
58+ dotnet nuget push artifacts\*.nupkg `
59+ --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" `
60+ --source https://api.nuget.org/v3/index.json `
61+ --skip-duplicate
0 commit comments