|
5 | 5 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
6 | 6 | DOTNET_ENVIRONMENT: github |
7 | 7 | ASPNETCORE_ENVIRONMENT: github |
8 | | - BUILD_PATH: '${{github.workspace}}/artifacts' |
9 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 8 | + BUILD_PATH: "${{github.workspace}}/artifacts" |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
10 | 12 |
|
11 | 13 | on: |
12 | 14 | push: |
13 | 15 | branches: |
14 | 16 | - master |
15 | 17 | - develop |
16 | 18 | tags: |
17 | | - - 'v*' |
| 19 | + - "v*" |
18 | 20 | paths-ignore: |
19 | | - - 'docs/**' |
20 | | - - 'mkdocs.yml' |
| 21 | + - "docs/**" |
| 22 | + - "mkdocs.yml" |
21 | 23 | pull_request: |
22 | 24 | branches: |
23 | 25 | - master |
24 | 26 | - develop |
25 | 27 |
|
26 | 28 | jobs: |
27 | | - |
28 | 29 | build: |
29 | 30 | runs-on: ubuntu-latest |
30 | 31 |
|
31 | 32 | services: |
32 | 33 | mssql: |
33 | 34 | image: mcr.microsoft.com/mssql/server:2019-latest |
34 | 35 | env: |
35 | | - MSSQL_SA_PASSWORD: '!P@ssw0rd' |
36 | | - ACCEPT_EULA: 'Y' |
| 36 | + MSSQL_SA_PASSWORD: "!P@ssw0rd" |
| 37 | + ACCEPT_EULA: "Y" |
37 | 38 | ports: |
38 | 39 | - 1433:1433 |
39 | 40 | volumes: |
40 | 41 | - mssql_data:/var/opt/mssql |
41 | 42 |
|
42 | 43 | steps: |
43 | | - - name: Checkout |
44 | | - uses: actions/checkout@v4 |
45 | | - with: |
46 | | - fetch-depth: 0 |
47 | | - |
48 | | - - name: Install .NET |
49 | | - uses: actions/setup-dotnet@v4 |
50 | | - with: |
51 | | - dotnet-version: | |
52 | | - 6.0.x |
53 | | - 8.0.x |
54 | | -
|
55 | | - - name: Restore Dependencies |
56 | | - run: dotnet restore |
57 | | - |
58 | | - - name: Build Solution |
59 | | - run: dotnet build --no-restore --configuration Release |
60 | | - |
61 | | - - name: Run Test |
62 | | - run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings |
63 | | - |
64 | | - - name: Report Coverage |
65 | | - if: success() |
66 | | - uses: coverallsapp/github-action@v2 |
67 | | - with: |
68 | | - file: "${{github.workspace}}/test/*/TestResults/*/coverage.info" |
69 | | - format: lcov |
70 | | - |
71 | | - - name: Create Packages |
72 | | - if: success() && github.event_name != 'pull_request' |
73 | | - run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}" |
74 | | - |
75 | | - - name: Upload Packages |
76 | | - if: success() && github.event_name != 'pull_request' |
77 | | - uses: actions/upload-artifact@v4 |
78 | | - with: |
79 | | - name: packages |
80 | | - path: '${{env.BUILD_PATH}}' |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v7 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Install .NET |
| 50 | + uses: actions/setup-dotnet@v5 |
| 51 | + with: |
| 52 | + dotnet-version: 10.x |
| 53 | + |
| 54 | + - name: Restore Dependencies |
| 55 | + run: dotnet restore |
| 56 | + |
| 57 | + - name: Build Solution |
| 58 | + run: dotnet build --no-restore --configuration Release |
| 59 | + |
| 60 | + - name: Run Test |
| 61 | + run: dotnet test --no-build --configuration Release --coverlet --coverlet-output-format lcov |
| 62 | + |
| 63 | + - name: Collect Coverage |
| 64 | + if: success() |
| 65 | + id: coverage |
| 66 | + run: | |
| 67 | + FILES=$(find ${{github.workspace}} -name 'coverage.*.info' -print | tr '\n' ' ') |
| 68 | + echo "files=$FILES" >> $GITHUB_OUTPUT |
| 69 | +
|
| 70 | + - name: Report Coverage |
| 71 | + if: success() && steps.coverage.outputs.files != '' |
| 72 | + uses: coverallsapp/github-action@v2 |
| 73 | + continue-on-error: true |
| 74 | + with: |
| 75 | + files: ${{ steps.coverage.outputs.files }} |
| 76 | + format: lcov |
| 77 | + |
| 78 | + - name: Create Packages |
| 79 | + if: success() && github.event_name != 'pull_request' |
| 80 | + run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}" |
| 81 | + |
| 82 | + - name: Upload Packages |
| 83 | + if: success() && github.event_name != 'pull_request' |
| 84 | + uses: actions/upload-artifact@v7 |
| 85 | + with: |
| 86 | + name: packages |
| 87 | + path: "${{env.BUILD_PATH}}" |
81 | 88 |
|
82 | 89 | deploy: |
83 | 90 | runs-on: ubuntu-latest |
84 | 91 | needs: build |
85 | 92 | if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) |
| 93 | + permissions: |
| 94 | + contents: read |
| 95 | + packages: write |
86 | 96 |
|
87 | 97 | steps: |
88 | | - - name: Download Artifact |
89 | | - uses: actions/download-artifact@v4 |
90 | | - with: |
91 | | - name: packages |
92 | | - |
93 | | - - name: Publish Packages GitHub |
94 | | - run: | |
95 | | - for package in $(find -name "*.nupkg"); do |
96 | | - echo "${0##*/}": Pushing $package... |
97 | | - dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
98 | | - done |
99 | | -
|
100 | | - - name: Publish Packages feedz |
101 | | - run: | |
102 | | - for package in $(find -name "*.nupkg"); do |
103 | | - echo "${0##*/}": Pushing $package... |
104 | | - dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate |
105 | | - done |
106 | | -
|
107 | | - - name: Publish Packages Nuget |
108 | | - if: startsWith(github.ref, 'refs/tags/v') |
109 | | - run: | |
110 | | - for package in $(find -name "*.nupkg"); do |
111 | | - echo "${0##*/}": Pushing $package... |
112 | | - dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate |
113 | | - done |
| 98 | + - name: Download Artifact |
| 99 | + uses: actions/download-artifact@v8 |
| 100 | + with: |
| 101 | + name: packages |
| 102 | + |
| 103 | + - name: Publish Packages GitHub |
| 104 | + env: |
| 105 | + GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + run: | |
| 107 | + for package in $(find -name "*.nupkg"); do |
| 108 | + echo "${0##*/}": Pushing $package... |
| 109 | + dotnet nuget push "$package" --source https://nuget.pkg.github.com/loresoft/index.json --api-key "$GITHUB_PACKAGE_TOKEN" --skip-duplicate |
| 110 | + done |
| 111 | +
|
| 112 | + - name: Publish Packages feedz |
| 113 | + env: |
| 114 | + FEEDZ_API_KEY: ${{ secrets.FEEDDZ_KEY }} |
| 115 | + run: | |
| 116 | + for package in $(find -name "*.nupkg"); do |
| 117 | + echo "${0##*/}": Pushing $package... |
| 118 | + dotnet nuget push "$package" --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key "$FEEDZ_API_KEY" --skip-duplicate |
| 119 | + done |
| 120 | +
|
| 121 | + - name: Publish Packages Nuget |
| 122 | + if: startsWith(github.ref, 'refs/tags/v') |
| 123 | + env: |
| 124 | + NUGET_API_KEY: ${{ secrets.NUGET_KEY }} |
| 125 | + run: | |
| 126 | + for package in $(find -name "*.nupkg"); do |
| 127 | + echo "${0##*/}": Pushing $package... |
| 128 | + dotnet nuget push "$package" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate |
| 129 | + done |
114 | 130 |
|
0 commit comments