mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-22 22:39:47 -05:00
162 lines
5.4 KiB
YAML
162 lines
5.4 KiB
YAML
# 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: release
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_type:
|
|
description: 'Release type'
|
|
required: true
|
|
type: choice
|
|
default: 'patch'
|
|
options:
|
|
- major
|
|
- minor
|
|
- patch
|
|
defaults:
|
|
run:
|
|
shell: bash --noprofile --norc -exo pipefail {0}
|
|
env:
|
|
HATCH_VERBOSE: 2
|
|
jobs:
|
|
release:
|
|
if: github.repository_owner == 'bentoml'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
with:
|
|
python-version: '3.11'
|
|
- name: Import bot's GPG key for signing commits
|
|
id: import-gpg
|
|
uses: crazy-max/ghaction-import-gpg@v5
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
git_config_global: true
|
|
git_user_signingkey: true
|
|
git_commit_gpgsign: true
|
|
git_tag_gpgsign: true
|
|
- name: Install jq and curl
|
|
run: sudo apt-get install -y jq curl
|
|
- name: Create a release
|
|
env:
|
|
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
|
|
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
|
|
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
|
|
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
|
|
run: ./.github/actions/release.sh --release ${{ inputs.release_type }}
|
|
- name: Set project version
|
|
id: version
|
|
run: |-
|
|
version="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
|
|
echo "Release version: $version"
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
publish-python:
|
|
needs:
|
|
- release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: '${{ needs.release.outputs.version }}'
|
|
- name: Setup CI
|
|
uses: ./.github/actions/setup-repo
|
|
- name: Install build frontend
|
|
run: python -m pip install --upgrade build
|
|
- name: Build
|
|
run: python -m build
|
|
- name: Publish to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
print-hash: true
|
|
prepare-next-dev-cycle:
|
|
needs:
|
|
- release
|
|
- publish-python
|
|
- binary-distribution
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup python
|
|
uses: actions/setup-python@v4
|
|
- name: Install dependencies
|
|
run: pip install hatch towncrier
|
|
- name: Install jq and curl
|
|
run: sudo apt-get install -y jq curl
|
|
- name: Import bot's GPG key for signing commits
|
|
id: import-gpg-key
|
|
uses: crazy-max/ghaction-import-gpg@v5
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
git_config_global: true
|
|
git_user_signingkey: true
|
|
git_commit_gpgsign: true
|
|
git_tag_gpgsign: true
|
|
- name: Bump version to dev
|
|
env:
|
|
GIT_AUTHOR_NAME: ${{ steps.import-gpg-key.outputs.name }}
|
|
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
|
|
GIT_COMMITTER_NAME: ${{ steps.import-gpg-key.outputs.name }}
|
|
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg-key.outputs.email }}
|
|
run: |
|
|
git pull --autostash --no-edit --gpg-sign --ff origin main
|
|
SEMVER="${{ needs.release.outputs.version }}"
|
|
SEMVER="${SEMVER#v}"
|
|
OLD_IFS=$IFS
|
|
IFS='.'
|
|
read -ra VERSION_BITS <<< "$SEMVER"
|
|
IFS=$OLD_IFS
|
|
VNUM1=${VERSION_BITS[0]}
|
|
VNUM2=${VERSION_BITS[1]}
|
|
VNUM3=${VERSION_BITS[2]}
|
|
VNUM3=$((VNUM3+1))
|
|
DEV_VERSION="$VNUM1.$VNUM2.$VNUM3.dev0"
|
|
echo "Bumping version to ${DEV_VERSION}..."
|
|
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
|
|
git add package.json && git commit -S -sm "infra: bump to dev version of ${DEV_VERSION} [generated] [skip ci]"
|
|
git push origin HEAD:main
|
|
binary-distribution:
|
|
if: github.repository_owner == 'bentoml'
|
|
needs: release
|
|
name: Create binary/wheels distribution
|
|
uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@main
|
|
release-notes:
|
|
if: github.repository_owner == 'bentoml'
|
|
needs:
|
|
- release
|
|
- publish-python
|
|
- binary-distribution
|
|
name: Create release notes and setup for next cycle
|
|
uses: bentoml/OpenLLM/.github/workflows/release-notes.yml@main
|
|
with:
|
|
tags: ${{ needs.release.outputs.version }}
|