release #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
LINES: 120 | |
COLUMNS: 120 | |
OPENLLM_DO_NOT_TRACK: True | |
PYTHONUNBUFFERED: '1' | |
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@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.OPENLLM_PAT }} | |
- uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1 | |
with: | |
bentoml-version: 'main' | |
python-version-file: .python-version-default | |
- name: Import bot's GPG key for signing commits | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6 | |
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 | |
compile-pypi: | |
if: github.repository_owner == 'bentoml' | |
needs: | |
- release | |
name: Compile PyPI distribution for OpenLLM | |
uses: bentoml/OpenLLM/.github/workflows/compile-pypi.yml@main # ratchet:exclude | |
with: | |
tags: ${{ needs.release.outputs.version }} | |
publish-python: | |
needs: | |
- compile-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1 | |
with: | |
ref: '${{ needs.release.outputs.version }}' | |
token: ${{ secrets.OPENLLM_PAT }} | |
# NOTE: Keep this section in sync with compile-pypi.yml | |
- name: Download Python artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 | |
with: | |
name: python-artefacts | |
path: dist | |
# - name: Download Linux x86_64 compiled artifacts | |
# uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 | |
# with: | |
# name: linux-x86_64-mypyc-wheels | |
# path: dist | |
# - name: Download MacOS x86_64 compiled artifacts | |
# uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 | |
# with: | |
# name: macos-x86_64-mypyc-wheels | |
# path: dist | |
# - name: Download MacOS arm64 compiled artifacts | |
# uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 | |
# with: | |
# name: macos-arm64-mypyc-wheels | |
# path: dist | |
# - name: Download MacOS universal2 compiled artifacts | |
# uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 | |
# with: | |
# name: macos-universal2-mypyc-wheels | |
# path: dist | |
- name: Smoke test compiled artefacts | |
run: ls -R dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # ratchet: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@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup python | |
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # ratchet:actions/setup-python@v4.7.1 | |
with: | |
python-version-file: .python-version-default | |
- 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@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6 | |
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 | |
pushd openllm-node &>/dev/null | |
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json | |
popd &>/dev/null | |
pushd openllm-contrib/clojure &>/dev/null | |
jq --arg release_version "${version}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json | |
popd &>/dev/null | |
git add package.json openllm-node/package.json openllm-contrib/clojure/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: compile-pypi | |
name: Create binary/wheels distribution | |
uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@main # ratchet:exclude | |
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 # ratchet:exclude | |
with: | |
tags: ${{ needs.release.outputs.version }} | |
bump-homebrew-tap: | |
needs: | |
- release-notes | |
- prepare-next-dev-cycle | |
- release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- uses: bentoml/setup-bentoml-action@862aa8fa0e0c3793fcca4bfe7a62717a497417e4 # ratchet:bentoml/setup-bentoml-action@v1 | |
with: | |
bentoml-version: 'main' | |
python-version-file: .python-version-default | |
- 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@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # ratchet:crazy-max/ghaction-import-gpg@v6 | |
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: Update current formula | |
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 }} | |
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }} | |
run: | | |
git pull --autostash --no-edit --gpg-sign --ff origin main | |
SEMVER="${{ needs.release.outputs.version }}" | |
SEMVER="${SEMVER#v}" | |
pip install fs jinja2 ghapi plumbum | |
./tools/update-brew-tap.py | |
git add Formula && git commit -S -sm "infra: bump to homebrew tap release to ${SEMVER} [generated] [skip ci]" | |
git push origin HEAD:main |