Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/scripts/create-platform-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ if [[ -z $NEW_VERSION_NUMBER && $PLATFORM == "mobile" ]]; then
exit 1
fi

###############################################################################
# Make a commit only when something is staged. Prevents git commit exit-1 when
# the version you’re bumping is already present on the branch.
###############################################################################
commit_if_needed () {
local msg="$1"

# --cached = compare index to HEAD, not working tree
if git diff --cached --quiet; then
echo "Nothing to commit – skipping."
else
git commit -m "$msg"
fi
}

get_expected_changed_files() {

local platform="$1"
Expand Down Expand Up @@ -128,9 +143,9 @@ git add $changed_files

# Generate a commit based on PLATFORM
if [ "$PLATFORM" = "mobile" ]; then
git commit -m "bump semvar version to ${NEW_VERSION} && build version to ${NEW_VERSION_NUMBER}"
commit_if_needed "bump semvar version to ${NEW_VERSION} && build version to ${NEW_VERSION_NUMBER}"
elif [ "$PLATFORM" = "extension" ]; then
git commit -m "bump semvar version to ${NEW_VERSION}"
commit_if_needed "bump semvar version to ${NEW_VERSION}"
fi


Expand Down
Loading