Skip to content

Commit 1933251

Browse files
committed
add build.yml
1 parent 5112d5c commit 1933251

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Publish to NuGet
2+
3+
on:
4+
push:
5+
branches:
6+
- nuget
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
build-and-publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write # Enable GitHub OIDC token issuance for this job
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '10.0.x'
24+
25+
- name: Restore dependencies
26+
run: dotnet restore
27+
28+
- name: Build
29+
run: dotnet build --configuration Release --no-restore
30+
31+
- name: Run tests
32+
run: dotnet test --configuration Release --no-build --verbosity normal
33+
34+
- name: Pack NuGet package
35+
run: dotnet pack src/Perigon.MiniDb/Perigon.MiniDb.csproj --configuration Release --output ./artifacts --no-build
36+
37+
- name: NuGet login (OIDC → temp API key)
38+
uses: NuGet/login@v1
39+
id: nuget-login
40+
with:
41+
user: ${{ secrets.NUGET_USER }}
42+
43+
- name: Publish to NuGet
44+
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

0 commit comments

Comments
 (0)