-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (46 loc) · 1.35 KB
/
Copy pathpublish.yml
File metadata and controls
56 lines (46 loc) · 1.35 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
name: Build and Publish
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
jobs:
build:
runs-on: windows-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg
- name: NuGet login (OIDC)
if: startsWith(github.ref, 'refs/tags/v')
uses: NuGet/login@v1
id: nuget-login
with:
user: ${{ secrets.NUGET_USER }}
- name: Push to NuGet
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
run: |
Get-ChildItem ./artifacts -Filter *.nupkg | ForEach-Object {
dotnet nuget push $_.FullName `
--api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" `
--source https://api.nuget.org/v3/index.json `
--skip-duplicate
}