Skip to content

Commit e95148e

Browse files
committed
Introduced workflow for deploying developer packages
Adds a GitHub workflow which builds all projects as packages, and pushes them to NuGet.org The workflow introduced provides new additional options to consumers/developers for dependency management. Developers now can cotntinue as-is with their submodule setup, or given some work, the option for loading nupkgs is available, via the official NuGet feed. This change introduces a new stateful dependency upon the repository. The owner or one in charge is expected to visit https://www.nuget.org/account/trustedpublishing and configure an entry for the repository that is deploying said nupkgs. There is two additional units of state that the owner or one in charge is expected to add. The `NUGET_USERNAME` secret to the GitHub repository configuration, and `EXCLUDE_NUGET_PACKAGES` which is a matching operator to nupkg file names. Two examples are as follows: *Avalonia* *Robust*|*Avalonia* This is available due to the fact that most likely not all package namespaces maintained by the robust team are actually owned by the team. Said convention violation results in a collision with claimed/protected namespaces on upload. Also, forks may wish to be able to be able to use this for debugging and developing purposes, like myself, so this is available. To what is known currently, the only namespace that collides with a protected namespace currently is `Avalonia`, however it *shouldn't* be an absolute requirement for this scope. As for everyone besides the robust team, most namespaces are available, except for of course, `Avalonia`, but also `SpaceWizards`. This workflow is dependent upon GitHub and NuGet, both owned by Microsoft. -# Also, this builds snupkgs too, the symbols files.
1 parent b46fbef commit e95148e

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish nupkgs to NuGet feed/package repository
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-publish:
10+
environment: dotnet
11+
permissions:
12+
id-token: write
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v7.0.0
18+
with:
19+
submodules: true
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v6.0.0
23+
with:
24+
dotnet-version: 10.0.x
25+
26+
- name: Install dependencies
27+
run: dotnet restore
28+
29+
- name: Build packages
30+
run: dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
31+
32+
- name: NuGet login
33+
uses: NuGet/login@v1
34+
id: login
35+
with:
36+
user: "${{ vars.NUGET_USERNAME }}"
37+
38+
- name: Push NuGet packages
39+
run: |
40+
for pkg in $(find . -name '*.nupkg'); do
41+
case "$pkg" in
42+
${{ vars.EXCLUDE_NUGET_PACKAGES }})
43+
echo "Skipping $pkg"
44+
continue
45+
;;
46+
esac
47+
48+
dotnet nuget push "$pkg" \
49+
--api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \
50+
--source https://api.nuget.org/v3/index.json \
51+
--skip-duplicate
52+
done
53+
54+
- name: Push symbol packages
55+
run: |
56+
for pkg in $(find . -name '*.snupkg'); do
57+
case "$pkg" in
58+
${{ vars.EXCLUDE_NUGET_PACKAGES }})
59+
echo "Skipping $pkg"
60+
continue
61+
;;
62+
esac
63+
64+
dotnet nuget push "$pkg" \
65+
--api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \
66+
--source https://api.nuget.org/v3/index.json \
67+
--skip-duplicate
68+
done

0 commit comments

Comments
 (0)