|
15 | 15 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
16 | 16 |
|
17 | 17 | jobs: |
18 | | - build: |
19 | | - runs-on: ubuntu-latest |
20 | | - steps: |
21 | | - |
22 | | - - name: Checkout code |
23 | | - uses: actions/checkout@v4 |
24 | | - with: |
25 | | - fetch-depth: 0 # avoid shallow clone so nbgv can do its work. |
26 | | - |
27 | | - - name: Setup .NET SDK |
28 | | - uses: actions/setup-dotnet@v4 |
29 | | - with: |
30 | | - global-json-file: ./global.json |
31 | | - |
32 | | - - name: Restore dependencies |
33 | | - run: dotnet restore |
34 | | - |
35 | | - - name: Setup Git Versioning |
36 | | - uses: dotnet/nbgv@master |
37 | | - id: nbgv |
38 | | - |
39 | | - - name: Show Version Info |
40 | | - run: | |
41 | | - echo 'SemVer2: ${{ steps.nbgv.outputs.SemVer2 }}' |
42 | | -
|
43 | | - - name: Build with dotnet |
44 | | - run: dotnet build |
45 | | - --no-restore --configuration ${{ env.BuildConfig }} |
46 | | - /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }} |
47 | | - |
48 | | - - name: Test with dotnet |
49 | | - run: dotnet test |
50 | | - --no-build --configuration ${{ env.BuildConfig }} |
51 | | - --logger "trx;LogFileName=test-results.trx" --results-directory ./artifacts/test-results |
52 | | - continue-on-error: true |
53 | | - |
54 | | - - name: Pack NuGet |
55 | | - run: dotnet pack |
56 | | - --configuration ${{ env.BuildConfig }} |
57 | | - --output ./artifacts/nuget-packages |
58 | | - /p:ContinuousIntegrationBuild=true |
59 | | - /p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }} |
60 | | - |
61 | | - - name: Upload Artifacts |
62 | | - uses: actions/upload-artifact@v4 |
63 | | - with: |
64 | | - name: artifacts |
65 | | - path: ./artifacts/**/* |
66 | | - |
67 | | - # the deploy job runs only when the build job is successful and the event is a release |
68 | | - deploy: |
69 | | - if: github.event_name == 'release' |
70 | | - name: Publish Package |
71 | | - needs: build |
72 | | - runs-on: ubuntu-latest |
73 | | - steps: |
74 | | - - name: Checkout code |
75 | | - uses: actions/checkout@v4 |
76 | | - with: |
77 | | - fetch-depth: 0 # avoid shallow clone so nbgv can do its work. |
78 | | - |
79 | | - - name: Download build artifacts |
80 | | - uses: actions/download-artifact@v4 |
81 | | - |
82 | | - - name: Upload release asset |
83 | | - run: gh release upload ${{ github.event.release.tag_name }} |
84 | | - ${{ github.workspace }}/artifacts/nuget-packages/*.*nupkg |
85 | | - env: |
86 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
87 | | - |
88 | | - - name: Setup .NET SDK |
89 | | - uses: actions/setup-dotnet@v4 |
90 | | - with: |
91 | | - global-json-file: ./global.json |
92 | | - |
93 | | - - name: Publish package |
94 | | - run: dotnet nuget push ${{github.workspace}}/artifacts/nuget-packages/*.nupkg |
95 | | - --source https://api.nuget.org/v3/index.json |
96 | | - --api-key ${{ secrets.NUGET_API_KEY }} |
97 | | - --skip-duplicate |
| 18 | + build: |
| 19 | + uses: mycsharp/github-actions/.github/workflows/dotnet-nuget-build.yml@main |
| 20 | + with: |
| 21 | + configuration: Release |
0 commit comments