File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish Filo Package
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ workflow_dispatch :
8+
9+ permissions :
10+ packages : write
11+ contents : read
12+
13+ jobs :
14+ publish :
15+ runs-on : windows-latest
16+
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+
21+ - name : Setup .NET
22+ uses : actions/setup-dotnet@v4
23+ with :
24+ dotnet-version : 10.0.x
25+
26+ - name : Restore Filo
27+ run : dotnet restore src/Filo/Filo.csproj
28+
29+ - name : Build Filo
30+ run : dotnet build src/Filo/Filo.csproj -c Release
31+
32+ - name : Pack Filo
33+ run : dotnet pack src/Filo/Filo.csproj -c Release --output ./nupkg
34+
35+ - name : Publish to nuget.org and GitHub Packages
36+ shell : pwsh
37+ run : |
38+ $nupkg = Get-ChildItem "./nupkg" -Filter "*.nupkg" | Select-Object -First 1 -ExpandProperty FullName
39+
40+ if ($nupkg) {
41+ Write-Output "Found package: $nupkg"
42+ # ── Publish to nuget.org ───────────────────────────────────────
43+ dotnet nuget push "$nupkg" `
44+ --source "https://api.nuget.org/v3/index.json" `
45+ --api-key "${{ secrets.NUGET_KEY }}" `
46+ --skip-duplicate
47+ # ── Publish to GitHub Packages ─────────────────────────────────
48+ # GITHUB_TOKEN is automatically available + has package:write permission
49+ dotnet nuget push "$nupkg" `
50+ --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" `
51+ --api-key "${{ secrets.GITHUB_TOKEN }}" `
52+ --skip-duplicate
53+ }
54+ else {
55+ Write-Output "No .nupkg found – skipping nuget.org"
56+ }
You can’t perform that action at this time.
0 commit comments