Skip to content

Commit

Permalink
add version element to csproj if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-drewery committed Dec 18, 2023
1 parent 5f45c9f commit 648fb14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ jobs:
packageName=$(grep -oPm1 "(?<=<PackageId>)[^<]+" $csprojFile || echo $(basename $csprojFile .csproj))
echo "Package name determined: $packageName"
# Extract major and minor version
# Extract or initialize the version
version=$(grep -oPm1 "(?<=<Version>)[^<]+" $csprojFile)
if [ -z "$version" ]; then
echo "No version found in $csprojFile, skipping..."
continue
echo "No version found in $csprojFile, initializing to default 1.0.0"
version="1.0.0"
sed -i "/<\/PropertyGroup>/i \ \ <Version>$version<\/Version>" $csprojFile
fi
echo "Current version: $version"
echo "Version: $version"
majorMinor=$(echo $version | cut -d'.' -f1,2)
echo "Major and minor version: $majorMinor"
Expand Down

0 comments on commit 648fb14

Please sign in to comment.