Skip to content

Update version to 2.1.0 and upgrade dependencies #33

Update version to 2.1.0 and upgrade dependencies

Update version to 2.1.0 and upgrade dependencies #33

Workflow file for this run

name: Build and Publish NuGet Package
on:
push:
branches:
- master
paths-ignore:
- "README.md"
- "LICENSE"
- "docs/**"
- ".github/workflows/jobs-example.yml"
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
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.401
- name: Restore NuGet packages (dependencies)
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
- name: Find NuGet package
id: find-package
run: |
NUPKG_PATH=$(find . -name '*.nupkg' -print -quit)
echo "NuGet package is at path: $NUPKG_PATH"
echo "NUPKG_PATH=$NUPKG_PATH" >> "$GITHUB_OUTPUT"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nuget-package.nupkg
path: ${{ steps.find-package.outputs.NUPKG_PATH }}
retention-days: 7
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: Download Artifact
uses: actions/download-artifact@v3
with:
name: nuget-package.nupkg
path: ${{ github.workspace }}
- name: Publish NuGet package
run: |
NUPKG_PATH=$(find . -name '*.nupkg' -print -quit)
echo "NuGet package path (as found in this job): $NUPKG_PATH"
dotnet nuget push $NUPKG_PATH --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
# echo "Placeholder for publishing NuGet package"