Skip to content

Merge pull request #46 from ButterCMS/feature/api-changes #6

Merge pull request #46 from ButterCMS/feature/api-changes

Merge pull request #46 from ButterCMS/feature/api-changes #6

Workflow file for this run

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/checkout@v3.5.3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3.2.0
- 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/upload-artifact@v3.1.3
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/setup-dotnet@v3.2.0
- uses: actions/download-artifact@v3.0.2
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/download-artifact@v3.0.2
with:
name: ${{ env.NUGET_ARTIFACT }}
path: ${{ env.NUGET_DIR }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v3.2.0
- 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