-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathpypi_deploy.sh
executable file
·74 lines (60 loc) · 1.89 KB
/
pypi_deploy.sh
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
#!/bin/bash
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# This script promotes Python packages from nightly releases to PyPI.
#
# Prerequisites:
# * For deploying to PyPI, you will need to have credentials set up. See
# https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
# * Install requirements, e.g. in a Python virtual environment (venv):
# `pip install -r requirements-packaging.txt`
# * Choose a release candidate to promote from
# https://github.com/iree-org/iree-turbine/releases/tag/dev-wheels
#
# Usage:
# python -m venv .venv
# source .venv/bin/activate
# pip install -r ./requirements-packaging.txt
# ./pypi_deploy.sh 3.1.0rc20241204
set -euo pipefail
RELEASE="$1"
SCRIPT_DIR="$(dirname -- "$( readlink -f -- "$0"; )")";
TMPDIR="$(mktemp --directory --tmpdir iree_turbine_pypi_wheels.XXXXX)"
ASSETS_PAGE="https://github.com/iree-org/iree-turbine/releases/expanded_assets/dev-wheels"
function download_wheels() {
echo ""
echo "Downloading wheels for '${RELEASE}'..."
python -m pip download iree-turbine==${RELEASE} --no-deps -f ${ASSETS_PAGE}
echo ""
echo "Downloaded wheels:"
ls
}
function edit_release_versions() {
echo ""
echo "Editing release versions..."
for file in *
do
${SCRIPT_DIR}/promote_whl_from_rc_to_final.py ${file} --delete-old-wheel
done
echo "Edited wheels:"
ls
}
function upload_wheels() {
# TODO: list packages that would be uploaded, pause, prompt to continue
echo ""
echo "Uploading wheels:"
ls
twine upload --verbose *
}
function main() {
echo "Changing into ${TMPDIR}"
cd "${TMPDIR}"
# TODO: check_requirements (using pip)
download_wheels
edit_release_versions
upload_wheels
}
main