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