-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a6aa9f
commit 18ee3d9
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
export USE_FULL_NUMERIC_PROVIDER=true | ||
|
||
|
||
echo "Pulling the latest repository changes" | ||
git pull | ||
|
||
|
||
echo "Checking out main branch" | ||
git checkout main | ||
|
||
|
||
echo "Obtaining release version" | ||
VERSION=$(grep "<Version>" Directory.Build.props | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/') | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo "Could not find <Version> in Directory.Build.props. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
echo "Detected release version: $VERSION" | ||
|
||
|
||
echo "Checking out release branch" | ||
git checkout release | ||
|
||
|
||
echo "Merging main branch into release branch" | ||
git merge main | ||
|
||
|
||
echo "Pushing release branch to origin" | ||
git push origin release | ||
|
||
|
||
echo "Building and testing .NET solution" | ||
dotnet build --configuration Release | ||
dotnet test --configuration Release | ||
|
||
|
||
echo "Creating new tag with version: $VERSION" | ||
git tag "$VERSION" | ||
git push origin "$VERSION" | ||
|
||
|
||
echo "Pushing packages to GitHub package registry" | ||
dotnet nuget push "OnixLabs.Core/bin/Release/OnixLabs.Core.$VERSION.nupkg" --source "github" | ||
dotnet nuget push "OnixLabs.DependencyInjection/bin/Release/OnixLabs.DependencyInjection.$VERSION.nupkg" --source "github" | ||
dotnet nuget push "OnixLabs.Numerics/bin/Release/OnixLabs.Numerics.$VERSION.nupkg" --source "github" | ||
dotnet nuget push "OnixLabs.Security/bin/Release/OnixLabs.Security.$VERSION.nupkg" --source "github" | ||
dotnet nuget push "OnixLabs.Security.Cryptography/bin/Release/OnixLabs.Security.Cryptography.$VERSION.nupkg" --source "github" | ||
|
||
|
||
echo "Pushing packages to NuGet package registry" | ||
dotnet nuget push "OnixLabs.Core/bin/Release/OnixLabs.Core.$VERSION.nupkg" --source "nuget.org" --api-key "$NUGET_API_KEY" | ||
dotnet nuget push "OnixLabs.DependencyInjection/bin/Release/OnixLabs.DependencyInjection.$VERSION.nupkg" --source "nuget.org" --api-key "$NUGET_API_KEY" | ||
dotnet nuget push "OnixLabs.Numerics/bin/Release/OnixLabs.Numerics.$VERSION.nupkg" --source "nuget.org" --api-key "$NUGET_API_KEY" | ||
dotnet nuget push "OnixLabs.Security/bin/Release/OnixLabs.Security.$VERSION.nupkg" --source "nuget.org" --api-key "$NUGET_API_KEY" | ||
dotnet nuget push "OnixLabs.Security.Cryptography/bin/Release/OnixLabs.Security.Cryptography.$VERSION.nupkg" --source "nuget.org" --api-key "$NUGET_API_KEY" | ||
|
||
|
||
echo "Build and release process completed successfully!" |