Publish to Nuget #9
This file contains 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 to Nuget' | |
on: | |
workflow_run: | |
workflows: [CI] | |
types: [completed] | |
branches: [master] | |
jobs: | |
publish-new-version: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Install Versionize | |
run: dotnet tool install --global Versionize | |
- name: Setup git | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Versionize Release | |
id: versionize | |
run: versionize --changelog-all --exit-insignificant-commits | |
continue-on-error: true | |
- name: No release required | |
if: steps.versionize.outcome != 'success' | |
run: echo "Skipping publishing. No release required." | |
- name: Build Package | |
if: steps.versionize.outcome == 'success' | |
run: dotnet pack --output nupkgs --include-source --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg | |
- name: Push to Nuget | |
if: steps.versionize.outcome == 'success' | |
run: dotnet nuget push "nupkgs/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} | |
- name: Push changes to GitHub | |
if: steps.versionize.outcome == 'success' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true |