|
1 | | -name: Build Project |
| 1 | +name: Build |
2 | 2 |
|
3 | 3 | env: |
4 | 4 | DOTNET_NOLOGO: true |
5 | 5 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
6 | | - BUILD_PATH: '${{github.workspace}}/artifacts' |
| 6 | + DOTNET_ENVIRONMENT: github |
| 7 | + ASPNETCORE_ENVIRONMENT: github |
| 8 | + BUILD_PATH: "${{github.workspace}}/artifacts" |
7 | 9 | COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
8 | 10 |
|
9 | 11 | on: |
|
12 | 14 | - main |
13 | 15 | - develop |
14 | 16 | tags: |
15 | | - - 'v*' |
| 17 | + - "v*" |
16 | 18 | pull_request: |
17 | 19 | branches: |
18 | 20 | - main |
19 | 21 | - develop |
20 | 22 |
|
21 | 23 | jobs: |
22 | 24 | build: |
23 | | - |
24 | 25 | runs-on: ubuntu-latest |
25 | 26 |
|
26 | 27 | steps: |
27 | | - - name: Checkout |
28 | | - uses: actions/checkout@v4 |
29 | | - with: |
30 | | - fetch-depth: 0 |
31 | | - |
32 | | - - name: Install .NET |
33 | | - uses: actions/setup-dotnet@v4 |
34 | | - with: |
35 | | - dotnet-version: 8.0.x |
36 | | - |
37 | | - - name: Restore Dependencies |
38 | | - run: dotnet restore |
39 | | - |
40 | | - - name: Build Solution |
41 | | - run: 'dotnet build --no-restore --configuration Release' |
42 | | - |
43 | | - - name: Run Test |
44 | | - run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings |
45 | | - |
46 | | - - name: Report Coverage |
47 | | - if: success() |
48 | | - uses: coverallsapp/github-action@v2 |
49 | | - with: |
50 | | - file: "${{github.workspace}}/test/*/TestResults/*/coverage.info" |
51 | | - format: lcov |
52 | | - |
53 | | - - name: Create Packages |
54 | | - if: success() && github.event_name != 'pull_request' |
55 | | - run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}" |
56 | | - |
57 | | - - name: Upload Packages |
58 | | - if: success() && github.event_name != 'pull_request' |
59 | | - uses: actions/upload-artifact@v4 |
60 | | - with: |
61 | | - name: packages |
62 | | - path: '${{env.BUILD_PATH}}' |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: Install .NET |
| 34 | + uses: actions/setup-dotnet@v4 |
| 35 | + with: |
| 36 | + dotnet-version: 8.0.x |
| 37 | + |
| 38 | + - name: Restore Dependencies |
| 39 | + run: dotnet restore |
| 40 | + |
| 41 | + - name: Build Solution |
| 42 | + run: dotnet build --no-restore --configuration Release |
| 43 | + |
| 44 | + - name: Run Test |
| 45 | + run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings |
| 46 | + |
| 47 | + - name: Report Coverage |
| 48 | + if: success() |
| 49 | + uses: coverallsapp/github-action@v2 |
| 50 | + with: |
| 51 | + file: "${{github.workspace}}/test/*/TestResults/*/coverage.info" |
| 52 | + format: lcov |
| 53 | + |
| 54 | + - name: Create Packages |
| 55 | + if: success() && github.event_name != 'pull_request' |
| 56 | + run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}" |
| 57 | + |
| 58 | + - name: Upload Packages |
| 59 | + if: success() && github.event_name != 'pull_request' |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: packages |
| 63 | + path: "${{env.BUILD_PATH}}" |
63 | 64 |
|
64 | 65 | deploy: |
65 | 66 | runs-on: ubuntu-latest |
66 | 67 | needs: build |
67 | 68 | if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) |
68 | 69 |
|
69 | 70 | steps: |
70 | | - - name: Download Artifact |
71 | | - uses: actions/download-artifact@v4 |
72 | | - with: |
73 | | - name: packages |
74 | | - |
75 | | - - name: Publish Packages feedz |
76 | | - run: | |
77 | | - for package in $(find -name "*.nupkg"); do |
78 | | - echo "${0##*/}": Pushing $package... |
79 | | - dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate |
80 | | - done |
81 | | -
|
82 | | - - name: Publish Packages GitHub |
83 | | - run: | |
84 | | - for package in $(find -name "*.nupkg"); do |
85 | | - echo "${0##*/}": Pushing $package... |
86 | | - dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
87 | | - done |
88 | | -
|
89 | | - - name: Publish Packages Nuget |
90 | | - if: startsWith(github.ref, 'refs/tags/v') |
91 | | - run: | |
92 | | - for package in $(find -name "*.nupkg"); do |
93 | | - echo "${0##*/}": Pushing $package... |
94 | | - dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate |
95 | | - done |
96 | | -
|
| 71 | + - name: Download Artifact |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: packages |
| 75 | + |
| 76 | + - name: Publish Packages GitHub |
| 77 | + run: | |
| 78 | + for package in $(find -name "*.nupkg"); do |
| 79 | + echo "${0##*/}": Pushing $package... |
| 80 | + dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
| 81 | + done |
| 82 | +
|
| 83 | + - name: Publish Packages feedz |
| 84 | + run: | |
| 85 | + for package in $(find -name "*.nupkg"); do |
| 86 | + echo "${0##*/}": Pushing $package... |
| 87 | + dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate |
| 88 | + done |
| 89 | +
|
| 90 | + - name: Publish Packages Nuget |
| 91 | + if: startsWith(github.ref, 'refs/tags/v') |
| 92 | + run: | |
| 93 | + for package in $(find -name "*.nupkg"); do |
| 94 | + echo "${0##*/}": Pushing $package... |
| 95 | + dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate |
| 96 | + done |
0 commit comments