|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + release-please: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + outputs: |
| 22 | + release_created: ${{ steps.release.outputs.release_created }} |
| 23 | + version: ${{ steps.release.outputs.version }} |
| 24 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 25 | + |
| 26 | + steps: |
| 27 | + - id: release |
| 28 | + uses: googleapis/release-please-action@v4 |
| 29 | + with: |
| 30 | + config-file: release-please-config.json |
| 31 | + manifest-file: .release-please-manifest.json |
| 32 | + |
| 33 | + publish: |
| 34 | + if: needs.release-please.outputs.release_created == 'true' |
| 35 | + needs: release-please |
| 36 | + runs-on: ubuntu-latest |
| 37 | + |
| 38 | + env: |
| 39 | + VERSION: ${{ needs.release-please.outputs.version }} |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Setup .NET |
| 45 | + uses: actions/setup-dotnet@v4 |
| 46 | + with: |
| 47 | + dotnet-version: | |
| 48 | + 6.0.x |
| 49 | + 8.0.x |
| 50 | + 9.0.x |
| 51 | + 10.0.x |
| 52 | +
|
| 53 | + - name: Build |
| 54 | + run: | |
| 55 | + dotnet build TriasDev.Templify/TriasDev.Templify.csproj \ |
| 56 | + --configuration Release \ |
| 57 | + -p:Version=${{ env.VERSION }} |
| 58 | +
|
| 59 | + - name: Run tests |
| 60 | + run: | |
| 61 | + dotnet test TriasDev.Templify.Tests/TriasDev.Templify.Tests.csproj \ |
| 62 | + --configuration Release \ |
| 63 | + --no-build \ |
| 64 | + --verbosity normal |
| 65 | +
|
| 66 | + - name: Pack |
| 67 | + run: | |
| 68 | + dotnet pack TriasDev.Templify/TriasDev.Templify.csproj \ |
| 69 | + --configuration Release \ |
| 70 | + --no-build \ |
| 71 | + -p:Version=${{ env.VERSION }} \ |
| 72 | + --output ./artifacts |
| 73 | +
|
| 74 | + - name: Push to NuGet |
| 75 | + run: | |
| 76 | + dotnet nuget push ./artifacts/*.nupkg \ |
| 77 | + --source https://api.nuget.org/v3/index.json \ |
| 78 | + --api-key ${{ secrets.NUGET_API_KEY }} \ |
| 79 | + --skip-duplicate |
| 80 | +
|
| 81 | + - name: Upload artifacts |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: nuget-packages |
| 85 | + path: ./artifacts/*.nupkg |
| 86 | + |
| 87 | + - name: Summary |
| 88 | + run: | |
| 89 | + echo "## NuGet Release" >> $GITHUB_STEP_SUMMARY |
| 90 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 91 | + echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY |
| 92 | + echo "|-----|-------|" >> $GITHUB_STEP_SUMMARY |
| 93 | + echo "| **Package** | \`TriasDev.Templify\` |" >> $GITHUB_STEP_SUMMARY |
| 94 | + echo "| **Version** | \`${{ env.VERSION }}\` |" >> $GITHUB_STEP_SUMMARY |
| 95 | + echo "| **Tag** | \`${{ needs.release-please.outputs.tag_name }}\` |" >> $GITHUB_STEP_SUMMARY |
0 commit comments