Skip to content

Workflow file for this run

name: .NET 6 CI with NuGet Deployment
on: [push, pull_request]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0' # 更新為.NET 6
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --collect:"XPlat Code Coverage"
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: jiowchern/PinionCyber.StateManagement
files: '**/coverage.cobertura.xml'
- name: Pack
run: dotnet pack --no-build -c Release -o ./nupkg
- name: Push NuGet Package
run: dotnet nuget push "./nupkg/*.nupkg" --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
if: github.ref == 'refs/heads/main' # 僅在主分支上推送NuGet包