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