Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

jobs:
build-and-publish:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -25,10 +25,41 @@ jobs:
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack --no-build --configuration Release PAYNLSDK/PayNLSdk.csproj --output .
- name: Push Nuget
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/release/v') }}
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
*.nupkg
*.snupkg

publish:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/release/v')
permissions:
id-token: write
contents: read
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Download packages
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Get NuGet OIDC token
id: oidc
uses: actions/github-script@v7
with:
script: |
const token = await core.getIDToken('api.nuget.org');
core.setSecret(token);
core.setOutput('token', token);
- name: Push to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
NUGET_TOKEN: ${{ steps.oidc.outputs.token }}
run: |
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate
dotnet nuget push *.snupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_TOKEN" --skip-duplicate
dotnet nuget push *.snupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_TOKEN" --skip-duplicate
Loading