Manual Release #2038
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: Manual Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_token: | |
description: 'Your release token' | |
required: true | |
release_reason: | |
description: 'Short reason for this manual release' | |
required: true | |
jobs: | |
token-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check release token | |
id: token-check | |
run: | | |
touch SUCCESS | |
if: inputs.release_token == env.release_token | |
env: | |
release_token: ${{ secrets.JINA_CORE_RELEASE_TOKEN }} | |
- name: Fail release token | |
run: | | |
[[ -f SUCCESS ]] | |
# Build the wheels for Linux, Windows and macOS for Python 3.8 and newer | |
build-wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
include: | |
# linux | |
- os: ubuntu-latest | |
python: '3.7' | |
python-manylinux-tag: "cp37-cp37m" | |
- os: ubuntu-latest | |
python: '3.8' | |
python-manylinux-tag: "cp38-cp38" | |
- os: ubuntu-latest | |
python: '3.9' | |
python-manylinux-tag: "cp39-cp39" | |
- os: ubuntu-latest | |
python: '3.10' | |
python-manylinux-tag: "cp310-cp310" | |
- os: ubuntu-latest | |
python: '3.11' | |
python-manylinux-tag: "cp311-cp311" | |
# MacOS emulated | |
- os: macos-latest | |
python: '3.8' | |
python-cibuildwheels: '38' | |
platform_id: macosx_x86_64 | |
arch: x86_64 | |
goarch: amd64 | |
- os: macos-latest | |
python: '3.9' | |
python-cibuildwheels: '39' | |
platform_id: macosx_x86_64 | |
arch: x86_64 | |
goarch: amd64 | |
- os: macos-latest | |
python: '3.10' | |
python-cibuildwheels: '310' | |
platform_id: macosx_x86_64 | |
arch: x86_64 | |
goarch: amd64 | |
- os: macos-latest | |
python: '3.11' | |
python-cibuildwheels: '311' | |
platform_id: macosx_x86_64 | |
arch: x86_64 | |
goarch: amd64 | |
# MacOS native | |
- os: macos-latest | |
python: '3.8' | |
python-cibuildwheels: '38' | |
platform_id: macosx_arm64 | |
arch: arm64 | |
goarch: arm64 | |
- os: macos-latest | |
python: '3.9' | |
python-cibuildwheels: '39' | |
platform_id: macosx_arm64 | |
arch: arm64 | |
goarch: arm64 | |
- os: macos-latest | |
python: '3.10' | |
python-cibuildwheels: '310' | |
platform_id: macosx_arm64 | |
arch: arm64 | |
goarch: arm64 | |
- os: macos-latest | |
python: '3.11' | |
python-cibuildwheels: '311' | |
platform_id: macosx_arm64 | |
arch: arm64 | |
goarch: arm64 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 200 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Set up Golang | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19.5 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
pip install git+https://github.com/jina-ai/setuptools-golang.git@feat-align-with-alaeddine-code | |
pip install cibuildwheel | |
- name: Build wheels with setuptools-golang-build-manylinux-wheel | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
setuptools-golang-build-manylinux-wheels --pythons ${{ matrix.python-manylinux-tag }} | |
- name: Build wheels with cibuildwheels on macos | |
env: | |
CIBW_BUILD: cp${{ matrix.python-cibuildwheels }}-${{ matrix.platform_id }} | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_TEST_COMMAND: python -c "import jina; import jraft" | |
CIBW_BUILD_VERBOSITY: 1 | |
GOARCH: ${{ matrix.goarch }} | |
CGO_ENABLED: 1 | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
python -m cibuildwheel --output-dir dist | |
- name: Upload wheels as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.whl | |
regular-release: | |
needs: [token-check, build-wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
token: ${{ secrets.JINA_DEV_BOT }} | |
fetch-depth: 100 # means max contribute history is limited to 100 lines | |
# submodules: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
# https://github.com/actions/checkout#fetch-all-tags | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- run: | | |
git fetch --depth=200 | |
npm install git-release-notes | |
pip install twine wheel | |
./scripts/release.sh final "${{ github.event.inputs.release_reason }}" "${{github.actor}}" | |
env: | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
JINA_SLACK_WEBHOOK: ${{ secrets.JINA_SLACK_WEBHOOK }} | |
- if: failure() | |
run: echo "nothing to release" | |
- name: bumping master version | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.JINA_DEV_BOT }} | |
tags: true | |
branch: ${{ github.ref }} |