Skip to content

Commit

Permalink
feat: try previous minor build definition
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Nov 25, 2024
1 parent 9aaf2a6 commit d77e9c9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ function check_semver () {
}

if [[ ! -f "/usr/local/share/php-build/definitions/${VERSION}" ]]; then
echo "Missing build definition for ${VERSION}. Trying to find older patch build definition"
echo "Missing build definition for ${VERSION}. Trying to find older build definition."
check_semver "${VERSION}"
if [[ ! "${MAJOR}" || ! "${MINOR}" || ! "${PATCH}" ]]; then
echo Invalid version: "${TOOL_VERSION}" >&2
exit 1
fi
oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1)

oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.${MINOR}.*" -printf '%f\n' | sort --version-sort -r | head -n 1)
if [[ -z $oldVersion ]]; then
echo "No usable definition found" >&2
exit 1
oldVersion=$(find /usr/local/share/php-build/definitions -type f -name "${MAJOR}.$((MINOR-1)).*" -printf '%f\n' | sort --version-sort -r | head -n 1)
if [[ -z $oldVersion ]]; then
echo "No usable definition found" >&2
exit 1
fi
fi

echo "Using $oldVersion"
Expand Down

0 comments on commit d77e9c9

Please sign in to comment.