build: adding tagging for the release process
This commit is contained in:
parent
fe53cfb17e
commit
d4d7ff4cba
2 changed files with 21 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
pkgs.convco
|
||||
pkgs.nodePackages.prettier
|
||||
pkgs.nixfmt
|
||||
pkgs.jq
|
||||
];
|
||||
};
|
||||
});
|
||||
|
|
|
@ -6,20 +6,28 @@ cd $(dirname $0)/..
|
|||
# Verify the input.
|
||||
if [ "x$NUGET_TOKEN" = "x" ]
|
||||
then
|
||||
echo "The environment variable NUGET_TOKEN is not defined"
|
||||
echo "the environment variable NUGET_TOKEN is not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$NUGET_PUSH_URL" = "x" ]
|
||||
then
|
||||
echo "The environment variable NUGET_PUSH_URL is not defined"
|
||||
echo "the environment variable NUGET_PUSH_URL is not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up everything from the previous runs.
|
||||
dotnet clean
|
||||
|
||||
# Version the file based on the Git repository.
|
||||
(cd src && dotnet dotnet-gitversion /updateprojectfiles)
|
||||
SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)"
|
||||
|
||||
if [ "x$SEMVER" = "x" ]
|
||||
then
|
||||
echo "cannot figure out the semantic version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build to pick up the new version.
|
||||
dotnet build
|
||||
|
@ -27,3 +35,13 @@ 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
|
||||
|
||||
# Tag and push, but only if we don't have a tag.
|
||||
if ! git tag | grep $SEMVER >& /dev/null
|
||||
then
|
||||
echo "tagging and pushing"
|
||||
git tag $SEMVER
|
||||
git push origin $SEMVER
|
||||
else
|
||||
echo "not tagging, already exists"
|
||||
fi
|
||||
|
|
Reference in a new issue