Merge pull request #41 from ButterCMS/release-please--branches--maste… #2
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: NuGet Publish | |
on: | |
push: | |
branches: [ master ] | |
env: | |
NUGET_DIR: ${{ github.workspace }}/nuget | |
NUGET_ARTIFACT: nuget | |
jobs: | |
testing: | |
if: contains(github.event.head_commit.message, 'chore(release)') | |
uses: ./.github/workflows/test.yml | |
pack: | |
if: contains(github.event.head_commit.message, 'chore(release)') | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/[email protected] | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
- run: sed -E -i'.bak' 's:RepositoryCommit>.+</:RepositoryCommit>${{ github.sha }}</:g' ButterCMS/ButterCMS.csproj | |
- run: dotnet pack --configuration Release --output "${{ env.NUGET_DIR }}" | |
- uses: actions/[email protected] | |
with: | |
name: ${{ env.NUGET_ARTIFACT }} | |
path: ${{ env.NUGET_DIR }} | |
if-no-files-found: error | |
retention-days: 1 | |
validate-nuget: | |
runs-on: ubuntu-22.04 | |
needs: pack | |
steps: | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
name: ${{ env.NUGET_ARTIFACT }} | |
path: ${{ env.NUGET_DIR }} | |
- name: Install nuget validator | |
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global | |
- name: Validate nuget package | |
run: meziantou.validate-nuget-package --excluded-rules Symbols ${{ env.NUGET_DIR }}/*.nupkg | |
publish: | |
runs-on: ubuntu-22.04 | |
needs: [validate-nuget, testing] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
name: ${{ env.NUGET_ARTIFACT }} | |
path: ${{ env.NUGET_DIR }} | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
- name: Publish nuget package | |
run: dotnet nuget push "${{ env.NUGET_DIR }}/*.nupkg" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json | |