Publish #10
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 | |
| on: | |
| # trigger only on completion of Build on main | |
| workflow_run: | |
| workflows: ["Build"] | |
| branches: | |
| - main | |
| types: | |
| - completed | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| source-url: https://api.nuget.org/v3/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{secrets.NUGET_KEY}} | |
| - name: Setup Git | |
| uses: fregante/setup-git-user@v2 | |
| - name: Restore Dotnet Tools | |
| run: dotnet tool restore | |
| - name: Run Versionize | |
| id: versionize | |
| run: dotnet versionize | |
| continue-on-error: true | |
| - name: No release required | |
| if: steps.versionize.outcome != 'success' | |
| run: echo "Skipping publishing. No release required." | |
| - name: Build | |
| if: steps.versionize.outcome == 'success' | |
| run: dotnet build ./ApiStub.FSharp --configuration Release | |
| - name: Pack | |
| if: steps.versionize.outcome == 'success' | |
| run: dotnet pack ./ApiStub.FSharp --no-build --output ./nupkgs --include-source --configuration Release --include-symbols | |
| - name: Push Package | |
| if: steps.versionize.outcome == 'success' | |
| run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{secrets.NUGET_KEY}} --skip-duplicate | |
| - name: Push changes to GitHub | |
| if: steps.versionize.outcome == 'success' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: main | |
| tags: true |