|
| 1 | +name: 💿 CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + tags: |
| 8 | + - "v*" |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - "master" |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: 🏭 Build & Test |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + steps: |
| 19 | + - name: 🚚 Checkout |
| 20 | + uses: actions/checkout@v3 |
| 21 | + - name: 🛠 Setup .NET Core |
| 22 | + uses: actions/setup-dotnet@v2 |
| 23 | + - name: ⚙ Restore |
| 24 | + run: dotnet restore |
| 25 | + - name: 🏭 Build |
| 26 | + run: dotnet build --no-restore -c Release /p:ContinuousIntegrationBuild=true |
| 27 | + - name: 🧪 Run tests |
| 28 | + run: dotnet test --no-build -c Release --filter FullyQualifiedName\!~Tests.Integration /p:CollectCoverage=true /p:CoverletOutputFormat=opencover |
| 29 | + - name: ☢ Publish to Codecov |
| 30 | + uses: codecov/codecov-action@v2 |
| 31 | + - name: 🗜 Pack Dev NuGet artifacts |
| 32 | + if: github.ref == 'refs/heads/master' |
| 33 | + run: dotnet pack --no-build -c Release --version-suffix dev-$(date +%s) -o artifacts/ |
| 34 | + - name: 🗜 Pack NuGet artifacts |
| 35 | + if: startsWith(github.ref, 'refs/tags/v') |
| 36 | + run: dotnet pack --no-build -c Release -o artifacts/ |
| 37 | + - name: 📤 Upload artifacts |
| 38 | + uses: actions/upload-artifact@v3 |
| 39 | + with: |
| 40 | + name: nupkg |
| 41 | + path: artifacts/* |
| 42 | + |
| 43 | + github: |
| 44 | + name: 🚀 Deploy to GitHub |
| 45 | + needs: [build] |
| 46 | + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') |
| 47 | + runs-on: ubuntu-22.04 |
| 48 | + steps: |
| 49 | + - name: 📥 Download artifacts |
| 50 | + uses: actions/download-artifact@v2 |
| 51 | + with: |
| 52 | + name: nupkg |
| 53 | + - name: 📦 Publish to GitHub |
| 54 | + run: dotnet nuget push "*.nupkg" -s https://nuget.pkg.github.com/prom-client-net/index.json -k ${{ secrets.GH_PKG_PAT }} --skip-duplicate |
| 55 | + nuget: |
| 56 | + name: 🚀 Deploy to Nuget |
| 57 | + needs: [build] |
| 58 | + if: startsWith(github.ref, 'refs/tags/v') |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + steps: |
| 61 | + - name: 📥 Download artifacts |
| 62 | + uses: actions/download-artifact@v2 |
| 63 | + with: |
| 64 | + name: nupkg |
| 65 | + - name: 📦 Publish to NuGet |
| 66 | + run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json |
0 commit comments