Skip to content
Merged
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
39 changes: 22 additions & 17 deletions .github/workflows/utils/bump-project-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,28 @@ if [[ -n "${1}" ]]; then
project_yaml="${1}"
fi

# Load the previous version and bump appropriately
version=$(cat "${project_yaml}" | awk '/^projectVersion:/ {
version = $2;
if (version ~ /-rc/) {
# Handle release candidate versions (e.g., v1.0.0-rc.1 -> v1.0.0-rc.2)
split(version, parts, /-rc\./);
rc_num = parts[2] + 1;
print parts[1] "-rc." rc_num;
}
else {
# Load the previous version and BUMP THE MINOR
# Handle minor version bumps (e.g., v1.0.0 -> v1.1.0)
split(version, ver_parts, /\./);
ver_parts[2] = ver_parts[2] + 1;
print ver_parts[1] "." ver_parts[2] ".0";
}
}')
if [[ -n "$GITHUB_REF_NAME" ]]; then
# Bump from provided version tag
version=$(echo $GITHUB_REF_NAME | awk -F'[ .]' '{print $1"."$2+1"."0}')
else
# Load the previous version and bump appropriately
version=$(cat "${project_yaml}" | awk '/^projectVersion:/ {
version = $2;
if (version ~ /-rc/) {
# Handle release candidate versions (e.g., v1.0.0-rc.1 -> v1.0.0-rc.2)
split(version, parts, /-rc\./);
rc_num = parts[2] + 1;
print parts[1] "-rc." rc_num;
}
else {
# Load the previous version and BUMP THE MINOR
# Handle minor version bumps (e.g., v1.0.0 -> v1.1.0)
split(version, ver_parts, /\./);
ver_parts[2] = ver_parts[2] + 1;
print ver_parts[1] "." ver_parts[2] ".0";
}
}')
fi

# Update the project yaml file
sed -i "s#^projectVersion:.*#projectVersion: ${version}#g" "${project_yaml}"
Expand Down
Loading