Skip to content

Commit 7876e90

Browse files
claudekhellang
authored andcommitted
Add NuGet packaging and GitHub Packages upload to CI
Add three new steps to the CI workflow: 1. Pack NuGet package: - Builds Release configuration of Scrutor.csproj - Outputs to ./artifacts directory - Creates deterministic .nupkg and .snupkg files 2. Upload NuGet package artifact: - Makes packages available as GitHub Actions artifacts - Useful for debugging and manual downloads - Preserved for workflow retention period 3. Push to GitHub Packages: - Only runs on push events (not pull requests) - Only runs on khellang/* repositories - Uses GITHUB_TOKEN for authentication - Skips duplicates to avoid errors on re-runs - Publishes to GitHub's NuGet feed This enables automatic package distribution on every push while maintaining deterministic, reproducible builds.
1 parent 4954c3b commit 7876e90

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ jobs:
3535
files: coverage.cobertura.xml
3636
token: ${{ secrets.CODECOV_TOKEN }}
3737
fail_ci_if_error: false
38+
39+
- name: Pack NuGet package
40+
run: dotnet pack src/Scrutor/Scrutor.csproj --configuration Release --output ./artifacts
41+
42+
- name: Upload NuGet package artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: nuget-packages
46+
path: ./artifacts/*.nupkg
47+
48+
- name: Push to GitHub Packages
49+
if: github.event_name == 'push' && startsWith(github.repository, 'khellang/')
50+
run: dotnet nuget push ./artifacts/*.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate

0 commit comments

Comments
 (0)