-
Notifications
You must be signed in to change notification settings - Fork 20
83 lines (69 loc) · 2.35 KB
/
release_pypi_macos.yml
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
# YAML schema for GitHub Actions:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
#
# Helpful YAML parser to clarify YAML syntax:
# https://yaml-online-parser.appspot.com/
#
# This workflow will
# 1. Build Python Wheel for MacOS
# 2. Upload Release Asset
name: Build and Release Python Package for MacOS
on:
workflow_call:
inputs:
tensorflow-commit:
required: false
type: string
nightly-release-date:
required: false
type: string
jobs:
build_release:
name: Build and Release Python Wheel for MacOS
strategy:
matrix:
runner: [macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set nightly release date
if: ${{ inputs.nightly-release-date != '' }}
run: |
DATE="${{ inputs.nightly-release-date }}"
echo "NIGHTLY_RELEASE_DATE=${DATE}" >> $GITHUB_ENV
- name: Init submodule
run: |
git submodule update --init --recursive
- name: Update submodule
if: ${{ inputs.tensorflow-commit != '' }}
run: |
git submodule update --remote
cd ./third_party/tensorflow
TF_COMMIT="${{ inputs.tensorflow-commit }}"
echo "checking out tensorflow-commit=${TF_COMMIT}"
git checkout -q ${TF_COMMIT}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install build wheel numpy twine
python -m pip list
- name: Build package
run: |
./ci/build_pip_package_with_bazel.sh
- name: Verify the distribution
run: twine check ./tflite/gen/litert_pip/python3/dist/*.whl
- name: List the contents of the wheel
run: |
wheels="./tflite/gen/litert_pip/python3/dist/*.whl"
for wheel in $wheels
do
echo "Listing $wheel"
python -m zipfile --list $wheel
done
- name: Upload to PyPI
run: twine upload ./tflite/gen/litert_pip/python3/dist/*.whl --non-interactive -p ${{ secrets.PYPI_UPLOAD_TOKEN }}