Merge branch 'main' of https://github.com/italia/pdnd-client-assertio… #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish NuGet Package | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
| push: | |
| tags: | |
| - 'v*' # This triggers the action when a tag prefixed with 'v' is created | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies for PDNDClientAssertionGenerator | |
| run: dotnet restore src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj | |
| - name: Restore dependencies for PDNDClientAssertionGenerator.Tests | |
| run: dotnet restore src/PDNDClientAssertionGenerator.Tests/PDNDClientAssertionGenerator.Tests.csproj | |
| - name: Build PDNDClientAssertionGenerator | |
| run: dotnet build src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --no-restore --configuration Release | |
| - name: Ensure output directory exists | |
| run: mkdir -p ./output | |
| - name: Pack the NuGet package | |
| run: dotnet pack src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --configuration Release --no-build --output ./output | |
| - name: Debug output directory | |
| run: ls -la ./output | |
| - name: Publish to NuGet | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: dotnet nuget push ./output/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| body: | | |
| Nuova versione pubblicata: ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload NuGet package as release asset | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./output/*.nupkg | |
| asset_name: package-${{ github.ref_name }}.nupkg | |
| asset_content_type: application/octet-stream |