Skip to content

Commit

Permalink
fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
417-72KI committed Oct 1, 2023
1 parent a50144a commit 2bdb53e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@ if [ `git symbolic-ref --short HEAD` != 'main' ]; then
fi

if [ "$(git status -s | grep "${APPLICATION_INFO_FILE}")" = '' ]; then
echo "\e[31m${APPLICATION_INFO_FILE} is not modified.\e[m"
CURRENT_VERSION=$(swift run "$EXECUTABLE_NAME" --version)
read "NEXT_VERSION?Next version(current: $(echo "\e[1m${CURRENT_VERSION}\e[m")) > "
if [ "${NEXT_VERSION}" = '' ]; then
NEXT_VERSION="${CURRENT_VERSION}"
fi
if [[ ! "${NEXT_VERSION}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-.*)?$ ]]; then
echo "\e[31m[Error] Invalid version format.\e[m"
exit 1
fi

sed -i '' -E "s/let version = \"(.*)\"/let version = \"${NEXT_VERSION}\"/" "${APPLICATION_INFO_FILE}"
fi

if [ "$(git tag | grep "$(swift run "$EXECUTABLE_NAME" --version)")" != '' ]; then
echo "\e[31m${NEXT_VERSION} is already tagged.\e[m"
git checkout HEAD -- Sources/Common/ApplicationInfo.swift
exit 1
fi

Expand Down

0 comments on commit 2bdb53e

Please sign in to comment.