Skip to content

add outputs to step build-and-test #9

add outputs to step build-and-test

add outputs to step build-and-test #9

Workflow file for this run

name: Build and Publish NuGet Package
on:
push:
branches:
- master
paths-ignore:
- "README.md"
- "LICENSE"
- "docs/**"
jobs:
# Based on the example from https://how.wtf/run-workflow-step-or-job-based-on-file-changes-github-actions.html
changes:
runs-on: ubuntu-latest
outputs:
version-changed: ${{ steps.changes.outputs.changed }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
changed:
- "Directory.Build.props"
build-and-test:
runs-on: ubuntu-latest
outputs:
nuget-package-path: ${{ steps.build-and-test.outputs.nuget-package-path }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.401
- name: Restore NuGet packages
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
# - name: Test (this will run for several minutes)
# run: dotnet test --configuration Release --no-restore --no-build --verbosity normal
deploy:
needs:
- changes
- build-and-test
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.version-changed == 'true' }}
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event.head_commit.modified || contains('Directory.Build.props') }}
steps:
- name: Publish NuGet package
run: |
pwd
ls -la
dotnet nuget push ${{needs.build-and-test.outputs.nuget-package-path }} --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json