-
Notifications
You must be signed in to change notification settings - Fork 23
119 lines (104 loc) · 3.91 KB
/
stable-release-workflow.yml
File metadata and controls
119 lines (104 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2025 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: Stable-release Tesseract
on:
release:
types: [published]
permissions:
contents: read
jobs:
create_version:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
with:
python-version: '3.10'
- name: Create version
run: |
mkdir version
echo "$(python _version.py)" > version/version.txt
cat version/version.txt
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: version-file
path: version
build_wheels:
runs-on: ${{ matrix.os }}
needs: [create_version]
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-14]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: version-file
path: version
- name: Set up Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
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.manylinux2014_x86_64\"/" BUILD -i || true
bazel build --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
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@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
pattern: python-wheels-*
merge-multiple: true
path: wheelhouse/
- name: Publish package to testpypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
repository_url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
packages_dir: wheelhouse/
verbose: true
- name: Publish package to pypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: wheelhouse/