Skip to content

Publish to Nuget

Publish to Nuget #30

Workflow file for this run

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
- 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