-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (41 loc) · 1.37 KB
/
publish.yml
File metadata and controls
51 lines (41 loc) · 1.37 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
name: Publish to Nuget
on:
workflow_dispatch:
release:
types: [published]
env:
SOLUTION_FILE: NimblePros.SharedKernel.slnx
PACK_OUTPUT: artifacts/package/release
jobs:
build:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Build
run: dotnet build "${{ env.SOLUTION_FILE }}" --configuration Release
- name: Test
run: dotnet test "${{ env.SOLUTION_FILE }}" --configuration Release --no-build --no-restore
- name: Pack
run: dotnet pack "${{ env.SOLUTION_FILE }}" --configuration Release --no-build --no-restore --output "${{ env.PACK_OUTPUT }}"
- name: NuGet login (OIDC -> temp API key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Push to NuGet
if: startsWith(github.ref, 'refs/tags/') # only push if building a tag
shell: pwsh
run: |
Get-ChildItem "${{ env.PACK_OUTPUT }}" -Filter *.nupkg | ForEach-Object {
dotnet nuget push $_.FullName `
--api-key "${{ steps.login.outputs.NUGET_API_KEY }}" `
--source https://api.nuget.org/v3/index.json
}