Build and push nuget #158
Workflow file for this run
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: Build and push nuget | |
on: | |
create: | |
tags: | |
- 'v*' | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-push-nuget: | |
env: | |
BUILD_CONFIG: "Release" | |
SOLUTION: "IIIF.sln" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./src/IIIF | |
steps: | |
- name: Check out code | |
id: checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: "5.x" | |
- name: Determine GitVersion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1.0.5 | |
- name: Restore dependencies | |
run: nuget restore $SOLUTION | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Build | |
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore -p:ContinuousIntegrationBuild=true | |
- name: Test | |
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal | |
- name: Pack | |
run: dotnet pack IIIF/IIIF.csproj --configuration $BUILD_CONFIG -p:Version=$GITVERSION_NUGETVERSION --no-restore --no-build | |
- name: Publish Package and Symbols | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |