Skip to content

Commit be1e640

Browse files
committed
Update github actions
1 parent 4d88c56 commit be1e640

2 files changed

Lines changed: 38 additions & 10 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish NuGet Package to GitHub Packages
2+
3+
on:
4+
push:
5+
branches: ['release']
6+
release:
7+
types: ['published']
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
attestations: write
16+
id-token: write
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v4
23+
24+
- name: Restore NuGet packages
25+
run: dotnet restore
26+
27+
- name: Build and pack NuGet package
28+
run: dotnet pack --configuration Release
29+
30+
- name: Publish NuGet package to GitHub Packages
31+
env:
32+
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
33+
OWNER: jacopouggeri
34+
run: |
35+
dotnet nuget add source --username $OWNER --password $PACKAGES_AUTH_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${OWNER}/index.json"
36+
dotnet nuget push bin/Release/*.nupkg --api-key $PACKAGES_AUTH_TOKEN --source "github"

.github/workflows/publish-nuget.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish NuGet Package
1+
name: Publish NuGet Package to NuGet.org
22

33
on:
44
push:
@@ -26,15 +26,7 @@ jobs:
2626

2727
- name: Build and pack NuGet package
2828
run: dotnet pack --configuration Release
29-
30-
- name: Publish NuGet package to GitHub Packages
31-
env:
32-
PACKAGES_AUTH_TOKEN: ${{ secrets.PACKAGES_AUTH_TOKEN }}
33-
OWNER: jacopouggeri
34-
run: |
35-
dotnet nuget add source --username $OWNER --password $PACKAGES_AUTH_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${OWNER}/index.json"
36-
dotnet nuget push bin/Release/*.nupkg --api-key $PACKAGES_AUTH_TOKEN --source "github"
37-
29+
3830
- name: Publish NuGet package to NuGet.org
3931
env:
4032
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}

0 commit comments

Comments
 (0)