Fix GitVersion command to handle errors and improve package versioning logic
This commit is contained in:
parent
057766ec4b
commit
f9a652f5cc
1 changed files with 6 additions and 2 deletions
|
|
@ -34,9 +34,13 @@ publish_nuget:
|
|||
git branch --show-current || true
|
||||
- dotnet tool install --global GitVersion.Tool --version 6.5.1 || true
|
||||
export PATH="$PATH:~/.dotnet/tools"
|
||||
GITVER=$(gitversion /showvariable NuGetVersionV2)
|
||||
GITVER=$(gitversion /showvariable NuGetVersionV2 || true)
|
||||
echo "Raw version: $GITVER"
|
||||
PACKAGE_VERSION=$(echo "$GITVER" | sed 's/[{}]//g' | sed 's/[^0-9A-Za-z.-]//g')
|
||||
PACKAGE_VERSION=$(echo "$GITVER" | sed 's/[{}]//g' | sed 's/[^0-9A-Za-z.-]//g' | sed 's#/+#-#g')
|
||||
if echo "$PACKAGE_VERSION" | grep -Eq '[{}]'; then
|
||||
echo "Computed package version still contains invalid characters; falling back to CI-based version"
|
||||
PACKAGE_VERSION="0.1.0-ci.$CI_COMMIT_SHORT_SHA"
|
||||
fi
|
||||
echo "Package version: $PACKAGE_VERSION"
|
||||
dotnet pack src/AIFotoONLUS.Core/AIFotoONLUS.Core.csproj -c Release -o nuget /p:PackageVersion="$PACKAGE_VERSION"
|
||||
dotnet nuget push "nuget/*.nupkg" --source "$NUGET_SOURCE" --api-key "$CI_JOB_TOKEN" --skip-duplicate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue