Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: release binary distribution #66

Merged
merged 11 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @aarnphm @parano @ssheng
* @aarnphm
3 changes: 0 additions & 3 deletions .github/actions/create_release_and_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ set -o errexit -o nounset -o pipefail
# Set by GH actions, see
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
TAG=${GITHUB_REF_NAME#v}
PREFIX="openllm-${TAG}"
ARCHIVE="openllm-${TAG}.tar.gz"

git archive --format=tar --prefix="${PREFIX}/" "v${TAG}" | gzip > "${ARCHIVE}"
cat > release_notes.txt << EOF
## Installation

Expand Down
56 changes: 50 additions & 6 deletions .github/actions/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,67 @@

set -e

# Function to print script usage
print_usage() {
echo "Usage: $0 [--release <major|minor|patch>]"
}

# Function to validate release argument
validate_release() {
local release=$1

if [[ $release == "major" || $release == "minor" || $release == "patch" ]]; then
return 0
else
return 1
fi
}

if ! [ "$GITHUB_ACTIONS" = true ]; then
echo "This script should only be run on GitHub Actions. Aborting."
exit 1
fi

echo "Cleaning previously built artifacts..." && hatch clean
# Check if release flag is provided
if [[ $1 == "--release" ]]; then
# Check if release argument is provided
if [[ -z $2 ]]; then
echo "Error: No release argument provided."
print_usage
exit 1
fi

CURRENT_VERSION=$(hatch version)
release=$2

if [[ $CURRENT_VERSION =~ \.dev ]]; then
RELEASE_VERSION="${CURRENT_VERSION%%.dev*}"
if ! validate_release "$release"; then
echo "Error: Invalid release argument. Only 'major', 'minor', or 'patch' are allowed."
print_usage
exit 1
fi
else
echo "Current version is not properly setup as dev version. Aborting..."
echo "Error: Unknown option or no option provided."
print_usage
exit 1
fi

echo "Releasing version $RELEASE_VERSION..." && hatch version "${RELEASE_VERSION}"
echo "Cleaning previously built artifacts..." && hatch clean

if [[ $release == 'major' ]]; then
RELEASE_VERSION=$(hatch version major)
elif [[ $release == 'minor' ]]; then
RELEASE_VERSION=$(hatch version minor)
else
CURRENT_VERSION=$(hatch version)

if [[ $CURRENT_VERSION =~ \.dev ]]; then
RELEASE_VERSION="${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

Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ updates:
- package-ecosystem: pip
directory: '/'
schedule:
interval: 'daily'
interval: 'weekly'
open-pull-requests-limit: 5
versioning-strategy: increase-if-necessary
32 changes: 32 additions & 0 deletions .github/workflows/auto-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2023 BentoML Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: auto-dependabot
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
branches:
- main
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading