Skip to content

Commit

Permalink
Handle build from same commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai Selivanov committed Feb 26, 2024
1 parent a5d9860 commit c4fc680
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,28 @@ jobs:
lastTagMainVersion=$(sed -n 's/^\([0-9]*\.[0-9]*\).*/\1/p' <<<"$lastTag")
currentVersion=$(cat VERSION)
currentMainVersion=$(sed -n 's/^\([0-9]*\.[0-9]*\).*/\1/p' <VERSION)
currentTag=$(git describe --tags --abbrev=0)
if [ "$lastTagMainVersion" = "$currentMainVersion" ]
then
echo "Version the same."
lastTagBuildVersion=$(sed -n 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p' <<<"$lastTag")
newBuildVersion=$((lastTagBuildVersion+1))
newVersion="$lastTagMainVersion"."$newBuildVersion"
newVersion=$lastTag
echo "newVersion=$newVersion"
echo "newVersion=$newVersion" >> $GITHUB_ENV
else
echo "New version!"
newVersion="$currentMainVersion".1
VersionPrefix=$newVersion
echo "newVersion=$newVersion"
echo "newVersion=$newVersion" >> $GITHUB_ENV
if [ "$lastTagMainVersion" = "$currentMainVersion" ]
then
echo "Version the same."
lastTagBuildVersion=$(sed -n 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p' <<<"$lastTag")
newBuildVersion=$((lastTagBuildVersion+1))
newVersion="$lastTagMainVersion"."$newBuildVersion"
echo "newVersion=$newVersion"
echo "newVersion=$newVersion" >> $GITHUB_ENV
else
echo "New version!"
newVersion="$currentMainVersion".1
VersionPrefix=$newVersion
echo "newVersion=$newVersion"
echo "newVersion=$newVersion" >> $GITHUB_ENV
fi
fi
sed -i '' -e "s/\(<Version>\)\(.*\)\(<\/Version>\)/\1$newVersion\3/" src/UnityMVVM/UnityMVVM.csproj
- name: Run tests
Expand Down

0 comments on commit c4fc680

Please sign in to comment.