Skip to content

Commit fa41179

Browse files
committed
feat: Publish NuGet package to github packages, with mechanisms to publish to nuget later
1 parent f64fcf6 commit fa41179

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/push_packages.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Publish NuGet packages"
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release/*
7+
tags:
8+
- release/*
9+
10+
concurrency:
11+
cancel-in-progress: true
12+
group: ${{ github.ref }}-${{ github.workflow }}
13+
14+
jobs:
15+
publish:
16+
permissions:
17+
packages: write
18+
contents: read
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: '0'
24+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
25+
# TODO: Use nbgv to create a release branch, push it, merge it back into master, bump to pre-release, and push
26+
# Also - Generate release notes
27+
- run: |
28+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
29+
git config --local user.name "GitHub Actions"
30+
- uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: '9.x'
33+
- run: dotnet pack -c Release -o ./artifacts/
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
name: artifacts
37+
path:
38+
./artifacts/*.nupkg
39+
./artifacts/*.snupkg
40+
- run: |
41+
dotnet nuget push ./artifacts/*.nupkg \
42+
-k ${{ secrets.GITHUB_TOKEN }} \
43+
-s https://nuget.pkg.github.com/NexusForever/index.json \
44+
--skip-duplicate \
45+
--no-symbols
46+
- if: ${{ github.ref != 'refs/heads/master' }}
47+
run: |
48+
dotnet nuget push ./artifacts/*.nupkg \
49+
-k ${{ secrets.NUGET_API_KEY }} \
50+
-s https://api.nuget.org/v3/index.json \
51+
--skip-duplicate \
52+
--no-symbols

0 commit comments

Comments
 (0)