-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathrelease-pypi-macos.sh
More file actions
47 lines (39 loc) · 1.39 KB
/
release-pypi-macos.sh
File metadata and controls
47 lines (39 loc) · 1.39 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
#!/bin/sh
set -e
# Different to release-pypi-win.cmd and release-pypi-osx.sh,
# this script has to be ran from a clean dockerfile
# Download and init conda
# Detect architecture and set appropriate Miniconda filename
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
MINICONDA_FILENAME=Miniconda3-latest-MacOSX-arm64.sh
else
MINICONDA_FILENAME=Miniconda3-latest-MacOSX-x86_64.sh
fi
curl -L -o $MINICONDA_FILENAME \
"https://repo.continuum.io/miniconda/$MINICONDA_FILENAME"
bash ${MINICONDA_FILENAME} -b -f -p $HOME/miniconda3
export PATH=$HOME/miniconda3/bin:$PATH
eval "$(conda shell.bash hook)"
# Accept conda Terms of Service for required channels
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
for PYTHON_VERSION in 3.10 3.11 3.12 3.13 3.14; do
# Create and activate environment
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -y -n py$PYTHON_VERSION python=$PYTHON_VERSION
conda activate py$PYTHON_VERSION
# Build and package
pip install --no-cache-dir build
python -m build --wheel
# Cleanup
conda deactivate
rm -rf build OpenCC.egg-info
done
if [ "$1" != "testonly" ]; then
# Upload to PyPI
conda activate py3.10
python -m pip install twine
python -m twine upload dist/*
fi