-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (28 loc) · 1.08 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 -c Release --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包