Skip to content

Update dry-run-release.yml #58

Update dry-run-release.yml

Update dry-run-release.yml #58

# Copyright 2026 Google LLC
#
# 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
#
# https://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: Dry Run Releasing Tesseract
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
create_version:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Create version
run: |
mkdir version
echo "$(python _version.py).dev$(date '+%Y%m%d%H%M%S')" > version/version.txt
cat version/version.txt
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: version-file
path: version
build_wheels:
runs-on: ${{ matrix.os }}
needs: [create_version]
strategy:
fail-fast: true
matrix:
os: [ubuntu-24.04, macos-14]
python-version: ['3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: version-file
path: version
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ matrix.os }}-py${{ matrix.python-version }}
repository-cache: true
- name: Set Python Version
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
echo "set version to ${TARGET_PYTHON}"
python _update_bazel_py_version.py $TARGET_PYTHON
- name: Build package
env:
TARGET_PYTHON: ${{ matrix.python-version }}
run: |
glibc_version=$(ldd --version | awk '/ldd/{print $NF}')
export GLIBC_VERSION="${glibc_version//./_}"
echo $GLIBC_VERSION
sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64\"/" BUILD -i || true
ABI_TAG="$(python -c "print(\"cp${TARGET_PYTHON}\".replace(\".\", \"\"))")"
echo $ABI_TAG
python -c "import sys; print(sys.abiflags)"
bazel build --define ABI_TAG=$ABI_TAG --define GLIBC_VERSION=$GLIBC_VERSION --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./bazel-bin/*.whl
release-wheels:
name: Publish all wheels
needs: [build_wheels]
runs-on: ubuntu-24.04
steps:
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: python-wheels-*
merge-multiple: true
path: wheelhouse/
- name: Test Wheels
run: |
pip install build twine
twine check wheelhouse/*
- name: Publish package to testpypi
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
packages-dir: wheelhouse/
verbose: true