|
8 | 8 |
|
9 | 9 | on: |
10 | 10 | push: |
11 | | - branches: [ master ] |
| 11 | + tags: |
| 12 | + - v[0-9]+.[0-9]+.[0-9]+* |
| 13 | + branches: [master] |
12 | 14 | pull_request: |
13 | | - branches: [ master ] |
| 15 | + branches: [master] |
| 16 | + release: |
14 | 17 |
|
15 | 18 | jobs: |
16 | 19 | build: |
17 | | - |
18 | 20 | runs-on: windows-latest |
19 | 21 | permissions: |
20 | 22 | packages: write |
21 | 23 | contents: read |
22 | 24 |
|
23 | 25 | steps: |
24 | | - - name: Checkout |
25 | | - uses: actions/checkout@v4 |
26 | | - with: |
27 | | - fetch-depth: 0 |
28 | | - - name: Setup .NET Core |
29 | | - uses: actions/setup-dotnet@v4 |
30 | | - with: |
31 | | - dotnet-version: | |
32 | | - 8.0.x |
33 | | - - name: Restore |
34 | | - run: dotnet tool restore |
35 | | - - name: Build |
36 | | - run: dotnet build -c Release |
37 | | - - name: Test |
38 | | - run: dotnet test --no-build -c Release tests |
39 | | - - name: Pack |
40 | | - run: dotnet pack --no-restore -c Release --include-symbols -o bin |
41 | | - - name: Upload Artifacts |
42 | | - uses: actions/upload-artifact@v4 |
43 | | - with: |
44 | | - name: nupkg-${{ matrix.runs-on }} |
45 | | - path: ./bin/*nupkg |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + - name: Setup .NET Core |
| 31 | + uses: actions/setup-dotnet@v4 |
| 32 | + with: |
| 33 | + dotnet-version: | |
| 34 | + 8.0.x |
| 35 | + - name: Set env |
| 36 | + if: startsWith( github.ref, 'refs/tags/v' ) |
| 37 | + run: | |
| 38 | + RELEASE_VERSION="${GITHUB_REF#refs/*/}" |
| 39 | + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV |
| 40 | + echo "Version=${RELEASE_VERSION:1}" >> $GITHUB_ENV |
| 41 | +
|
| 42 | + - name: Restore |
| 43 | + run: dotnet tool restore |
| 44 | + - name: Build |
| 45 | + run: dotnet build -c Release |
| 46 | + - name: Test |
| 47 | + run: dotnet test --no-build -c Release tests |
| 48 | + - name: Pack |
| 49 | + run: dotnet pack --no-restore -c Release --include-symbols -o bin |
| 50 | + |
| 51 | + - name: Upload Test Results |
| 52 | + if: failure() |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: verify-test-results |
| 56 | + path: | |
| 57 | + **/*.received.* |
| 58 | + - name: Upload Artifacts |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: nupkg-${{ matrix.runs-on }} |
| 62 | + path: ./bin/*nupkg |
| 63 | + - name: Push |
| 64 | + if: startsWith( github.ref, 'refs/tags/v' ) |
| 65 | + run: dotnet nuget push bin\*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }} |
0 commit comments