#!/usr/bin/env sh
cd $(dirname $0)/..
./scripts/setup.sh || exit 1
# Verify the input.
if [ "x$NUGET_TOKEN" = "x" ]
then
echo "The environment variable NUGET_TOKEN is not defined"
exit 1
fi
if [ "x$NUGET_PUSH_URL" = "x" ]
echo "The environment variable NUGET_PUSH_URL is not defined"
# Clean up everything from the previous runs.
dotnet clean
# Version the file based on the Git repository.
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
# Build to pick up the new version.
dotnet build
# Create and publish the NuGet packages.
dotnet pack --include-symbols --include-source
dotnet nuget push src/*/bin/Debug/*.nupkg --api-key $NUGET_TOKEN --source $NUGET_PUSH_URL