|
1 | | -name: dotnet build |
| 1 | +name: Build |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: |
| 6 | + - opened |
| 7 | + - synchronize |
| 8 | + - reopened |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +env: |
| 15 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 16 | + DOTNET_NOLOGO: true |
4 | 17 |
|
5 | 18 | jobs: |
6 | 19 | build: |
7 | 20 | runs-on: ubuntu-latest |
8 | | - strategy: |
9 | | - matrix: |
10 | | - dotnet-version: [ '7.0.x' ] |
11 | 21 | steps: |
12 | 22 | - uses: actions/checkout@v3 |
13 | 23 | with: |
14 | 24 | fetch-depth: '0' |
15 | | - - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} |
| 25 | + - name: Setup .NET Core SDK |
16 | 26 | uses: actions/setup-dotnet@v3 |
17 | 27 | with: |
18 | | - dotnet-version: ${{ matrix.dotnet-version }} |
| 28 | + dotnet-version: | |
| 29 | + 9.x |
| 30 | +
|
19 | 31 | - name: Restore .NET Packages |
20 | 32 | run: dotnet restore |
| 33 | + |
21 | 34 | - name: Build .NET Solution |
22 | 35 | run: dotnet build --configuration Release --no-restore |
| 36 | + |
| 37 | + - name: Test .NET Solution |
| 38 | + run: dotnet test --configuration Release --no-build --filter="Category=UnitTest|Category=IntegrationTest" --logger "trx;LogFilePrefix=test-results" |
| 39 | + |
| 40 | + - uses: actions/upload-artifact@v4 |
| 41 | + if: success() || failure() |
| 42 | + with: |
| 43 | + name: test-results |
| 44 | + path: "**/test-results*.trx" |
| 45 | + |
23 | 46 | - name: Pack .NET Solution |
24 | | - run: dotnet pack --no-build --output pack/ |
| 47 | + run: dotnet pack --configuration Release --no-build --output pack/ |
| 48 | + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} |
| 49 | + |
25 | 50 | - name: Publish .NET Solution to GitHub Packages |
26 | 51 | continue-on-error: true |
27 | | - run: dotnet nuget push pack/* --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" |
| 52 | + run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" |
| 53 | + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} |
| 54 | + |
| 55 | + - name: Store .NET Package |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: nuget |
| 59 | + if-no-files-found: error |
| 60 | + retention-days: 7 |
| 61 | + path: pack/*.nupkg |
| 62 | + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} |
| 63 | + |
28 | 64 | - name: Publish .NET Solution to NuGet.org |
29 | 65 | continue-on-error: true |
30 | | - run: dotnet nuget push pack/* --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget |
| 66 | + env: |
| 67 | + apikey: ${{ secrets.NUGET_ORG_KEY }} |
| 68 | + run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget |
| 69 | + if: ${{ env.apikey != '' && github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} |
31 | 70 |
|
0 commit comments