-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (57 loc) · 2.52 KB
/
publish-nuget.yml
File metadata and controls
70 lines (57 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Publish NuGet
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
runs-on: windows-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore YCode.Designer.Fluxo/YCode.Designer.Fluxo.csproj
- name: Build
run: dotnet build YCode.Designer.Fluxo/YCode.Designer.Fluxo.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
- name: Pack
run: dotnet pack YCode.Designer.Fluxo/YCode.Designer.Fluxo.csproj --configuration Release --no-build --output artifacts /p:ContinuousIntegrationBuild=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg
- name: Validate publishing configuration
shell: bash
run: |
if [[ -z "${{ vars.NUGET_USER }}" && -z "${{ secrets.NUGET_API_KEY }}" ]]; then
echo "Configure either repo variable NUGET_USER for Trusted Publishing or secret NUGET_API_KEY for classic publishing."
exit 1
fi
- name: NuGet login with Trusted Publishing
if: ${{ vars.NUGET_USER != '' && secrets.NUGET_API_KEY == '' }}
id: nuget-login
uses: NuGet/login@v1
with:
user: ${{ vars.NUGET_USER }}
- name: Push package with Trusted Publishing
if: ${{ vars.NUGET_USER != '' && secrets.NUGET_API_KEY == '' }}
run: |
dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
dotnet nuget push "artifacts/*.snupkg" --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
- name: Push package with classic API key
if: ${{ secrets.NUGET_API_KEY != '' }}
run: |
dotnet nuget push "artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
dotnet nuget push "artifacts/*.snupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate
- name: Upload published artifacts
uses: actions/upload-artifact@v4
with:
name: published-nuget-package
path: |
artifacts/*.nupkg
artifacts/*.snupkg