Skip to content

Commit dc7dcfe

Browse files
committed
Add PublishToNuGet.yml
1 parent 583bf69 commit dc7dcfe

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
name: Build, Pack, and Publish
9+
runs-on: windows-2022
10+
permissions:
11+
id-token: write # enable GitHub OIDC token issuance for this job
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
16+
17+
- name: Build projects
18+
shell: pwsh
19+
run: |
20+
Get-ChildItem ./src -Recurse -Filter *.csproj |
21+
ForEach-Object {
22+
dotnet build $_.FullName -c Release
23+
}
24+
25+
- name: Pack projects
26+
shell: pwsh
27+
run: |
28+
Get-ChildItem ./src -Recurse -Filter *.csproj |
29+
ForEach-Object {
30+
dotnet pack $_.FullName -c Release --no-build -o ./packages
31+
}
32+
33+
- name: NuGet login (OIDC → temp API key)
34+
uses: NuGet/login@v1
35+
id: login
36+
with:
37+
user: ${{ secrets.NUGET_USER }}
38+
39+
- name: Push to NuGet
40+
run: dotnet nuget push "**/packages/*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ jobs:
3838
run: |
3939
dotnet test ./test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj -c Release -p:buildType=azure-pipelines-ci
4040
41+
- name: Pack projects
42+
shell: pwsh
43+
run: |
44+
Get-ChildItem ./src -Recurse -Filter *.csproj |
45+
ForEach-Object {
46+
dotnet pack $_.FullName -c Release --no-build -o ./packages
47+
}
48+
4149
build_and_test_Linux:
4250
name: "Linux: Build and Tests"
4351
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)