Skip to content

Build and push nuget #172

Build and push nuget

Build and push nuget #172

Workflow file for this run

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}}