mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-22 14:31:26 -05:00
fix(ci): releas script correctly parse version
Signed-off-by: aarnphm-ec2-dev <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
45
.github/actions/release.sh
vendored
45
.github/actions/release.sh
vendored
@@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
# Function to print script usage
|
||||
print_usage() {
|
||||
@@ -58,33 +58,40 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release_package() {
|
||||
local version="$1"
|
||||
echo "Releasing version ${version}..."
|
||||
|
||||
jq --arg release_version "${version}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
|
||||
|
||||
towncrier build --yes --version "${version}"
|
||||
git add CHANGELOG.md changelog.d src/openllm/__about__.py package.json
|
||||
git commit -S -sm "infra: prepare for release ${version} [generated]"
|
||||
git push origin main
|
||||
|
||||
echo "Releasing tag ${version}..." && git tag -a "v${version}" -sm "Release ${version} [generated by GitHub Actions]"
|
||||
git push origin "v${version}"
|
||||
|
||||
echo "Finish releasing version ${version}"
|
||||
}
|
||||
|
||||
echo "Cleaning previously built artifacts..." && hatch clean
|
||||
|
||||
if [[ $release == 'major' ]]; then
|
||||
RELEASE_VERSION=$(hatch version major)
|
||||
hatch version major
|
||||
CURRENT_VERSION=$(hatch version)
|
||||
release_package "${CURRENT_VERSION}"
|
||||
elif [[ $release == 'minor' ]]; then
|
||||
RELEASE_VERSION=$(hatch version minor)
|
||||
hatch version minor
|
||||
CURRENT_VERSION="$(hatch version)"
|
||||
release_package "${CURRENT_VERSION}"
|
||||
else
|
||||
CURRENT_VERSION=$(hatch version)
|
||||
|
||||
if [[ $CURRENT_VERSION =~ \.dev ]]; then
|
||||
RELEASE_VERSION="${CURRENT_VERSION%%.dev*}"
|
||||
if [[ "$CURRENT_VERSION" =~ \.dev ]]; then
|
||||
release_package "${CURRENT_VERSION%%.dev*}"
|
||||
else
|
||||
echo "Current version is not properly setup as dev version. Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Releasing $release version $RELEASE_VERSION..." && hatch version "${RELEASE_VERSION}"
|
||||
|
||||
jq --arg release_version "${RELEASE_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
|
||||
|
||||
towncrier build --yes --version "${RELEASE_VERSION}"
|
||||
git add CHANGELOG.md changelog.d src/openllm/__about__.py package.json
|
||||
git commit -S -sm "infra: prepare for release ${RELEASE_VERSION} [generated]"
|
||||
git push origin main
|
||||
|
||||
echo "Releasing tag ${RELEASE_VERSION}..." && git tag -a "v${RELEASE_VERSION}" -sm "Release ${RELEASE_VERSION} [generated by GitHub Actions]"
|
||||
git push origin "v${RELEASE_VERSION}"
|
||||
|
||||
echo "Finish releasing version ${RELEASE_VERSION}"
|
||||
|
||||
Reference in New Issue
Block a user