Skip to content

Commit

Permalink
Fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard authored Jan 26, 2025
1 parent 57dee7d commit 04cf408
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,59 @@ jobs:
submodules: true
- name: Test
run: |
dotnet test -c Release -f net8
pushNuGetPackageToGitHubPackageRegistry:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
dotnet test -c Release -f net8name: Publish NuGet Package
on:
push:
branches:
- main
tags:
- 'v*.*.*'

jobs:
pushNuGetPackageToGitHubPackageRegistry:
needs: test
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- uses: actions/checkout@v3
with:
submodules: true

# 2. Setup .NET SDK
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-version: '8.0.x' # Specify your required .NET version

# 3. Restore dependencies
- name: Restore dependencies
run: dotnet restore

# 4. Build the project
- name: Build
run: dotnet build --configuration Release --no-restore

# 5. Pack the project into a NuGet package
- name: Pack
run: dotnet pack --configuration Release --no-restore --output ./nupkgs
- name: Push NuGet package to GitHub Package Registry

# 6. Add GitHub Package Registry as a NuGet source
- name: Add GitHub Package Registry as NuGet Source
run: |
dotnet nuget add source "https://nuget.pkg.github.com/linksplatform/index.json" \
--name "GitHub" \
--username "linksplatform" \
--password "${{ secrets.GITHUB_TOKEN }}" \
--store-password-in-clear-text
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# 7. Push the NuGet package to GitHub Package Registry
- name: Push NuGet Package to GitHub Package Registry
run: |
dotnet nuget push ./nupkgs/*.nupkg \
--source "github" \
--source "GitHub" \
--api-key "${{ secrets.GITHUB_TOKEN }}"
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 04cf408

Please sign in to comment.