|
| 1 | +name: Build |
| 2 | + |
| 3 | +env: |
| 4 | + DOTNET_NOLOGO: true |
| 5 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 6 | + DOTNET_ENVIRONMENT: github |
| 7 | + ASPNETCORE_ENVIRONMENT: github |
| 8 | + BUILD_PATH: "${{github.workspace}}/artifacts" |
| 9 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + - develop |
| 16 | + tags: |
| 17 | + - "v*" |
| 18 | + pull_request: |
| 19 | + branches: |
| 20 | + - main |
| 21 | + - develop |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + steps: |
| 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: 9.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 |
| 46 | + |
| 47 | + - name: Create Packages |
| 48 | + if: success() && github.event_name != 'pull_request' |
| 49 | + run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}" |
| 50 | + |
| 51 | + - name: Upload Packages |
| 52 | + if: success() && github.event_name != 'pull_request' |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: packages |
| 56 | + path: "${{env.BUILD_PATH}}" |
| 57 | + |
| 58 | + deploy: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: build |
| 61 | + if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Download Artifact |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + name: packages |
| 68 | + |
| 69 | + - name: Publish Packages GitHub |
| 70 | + run: | |
| 71 | + for package in $(find -name "*.nupkg"); do |
| 72 | + echo "${0##*/}": Pushing $package... |
| 73 | + dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |
| 74 | + done |
| 75 | +
|
| 76 | + - name: Publish Packages feedz |
| 77 | + run: | |
| 78 | + for package in $(find -name "*.nupkg"); do |
| 79 | + echo "${0##*/}": Pushing $package... |
| 80 | + dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate |
| 81 | + done |
| 82 | +
|
| 83 | + - name: Publish Packages Nuget |
| 84 | + if: startsWith(github.ref, 'refs/tags/v') |
| 85 | + run: | |
| 86 | + for package in $(find -name "*.nupkg"); do |
| 87 | + echo "${0##*/}": Pushing $package... |
| 88 | + dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate |
| 89 | + done |
0 commit comments