|
1 | | -name: CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [ master ] |
6 | | - tags: [ 'v*' ] |
7 | | - pull_request: |
8 | | - branches: [ master ] |
9 | | - |
10 | | -jobs: |
11 | | - build: |
12 | | - runs-on: ubuntu-latest |
13 | | - steps: |
14 | | - - uses: actions/checkout@v7 |
15 | | - with: |
16 | | - fetch-depth: 0 |
17 | | - |
18 | | - - name: Setup .NET |
19 | | - uses: actions/setup-dotnet@v6 |
20 | | - with: |
21 | | - dotnet-version: | |
22 | | - 8.0.x |
23 | | - 9.0.x |
24 | | - 10.0.x |
25 | | -
|
26 | | - - name: Restore dependencies |
27 | | - run: dotnet restore |
28 | | - |
29 | | - - name: Build |
30 | | - run: dotnet build --no-restore --configuration Release |
31 | | - |
32 | | - - name: Test |
33 | | - run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" |
34 | | - |
35 | | - - name: Upload coverage to Codecov |
36 | | - uses: codecov/codecov-action@v7 |
37 | | - with: |
38 | | - token: ${{ secrets.CODECOV_TOKEN }} |
39 | | - |
40 | | - - name: Pack |
41 | | - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
42 | | - run: dotnet pack --no-build --configuration Release --output ./artifacts |
43 | | - |
44 | | - - name: Publish to NuGet |
45 | | - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
46 | | - run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + tags: [ 'v*' ] |
| 7 | + pull_request: |
| 8 | + branches: [ master ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + environment: production |
| 14 | + permissions: |
| 15 | + contents: write |
| 16 | + id-token: write |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v7 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Setup .NET |
| 23 | + uses: actions/setup-dotnet@v6 |
| 24 | + with: |
| 25 | + dotnet-version: | |
| 26 | + 8.0.x |
| 27 | + 9.0.x |
| 28 | + 10.0.x |
| 29 | +
|
| 30 | + - name: Restore dependencies |
| 31 | + run: dotnet restore |
| 32 | + |
| 33 | + - name: Build |
| 34 | + run: dotnet build --no-restore --configuration Release |
| 35 | + |
| 36 | + - name: Test |
| 37 | + run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" |
| 38 | + |
| 39 | + - name: Upload coverage to Codecov |
| 40 | + uses: codecov/codecov-action@v7 |
| 41 | + with: |
| 42 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 43 | + |
| 44 | + - name: Pack |
| 45 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 46 | + run: dotnet pack --no-build --configuration Release --output ./artifacts |
| 47 | + |
| 48 | + - name: NuGet login |
| 49 | + id: nuget-login |
| 50 | + uses: NuGet/login@v1 |
| 51 | + with: |
| 52 | + user: JerrettDavis |
| 53 | + |
| 54 | + - name: Publish to NuGet |
| 55 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 56 | + run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
0 commit comments