11# See:
22# - <https://github.com/tauri-apps/tauri-action>
3- # - <https://wsh032 .github.io/pytauri/>
3+ # - <https://pytauri .github.io/pytauri/latest/usage/tutorial/build-standalone />
44
55name : ' publish (standalone)'
66
@@ -49,33 +49,41 @@ jobs:
4949
5050 - name : Rust cache
5151 uses : swatinem/rust-cache@v2
52-
52+
5353 - name : Install uv
5454 uses : astral-sh/setup-uv@v5
5555 with :
5656 enable-cache : true
57-
57+
5858 # see:
5959 # - <https://github.com/astral-sh/python-build-standalone/releases>
6060 # - <https://raw.githubusercontent.com/astral-sh/python-build-standalone/latest-release/latest-release.json>
6161 # - <https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions>
6262 - name : download python-build-standalone
6363 env :
6464 PYTHON_VERSION : ' 3.13.1' # update this by yourself
65- DATE : ' 20250115' # update this by yourself
65+ TAG : ' 20250115' # update this by yourself
6666 TARGET : ${{ matrix.target }}
6767 run : |
68- url="https://github.com/astral-sh/python-build-standalone/releases/download/${DATE}/cpython-${PYTHON_VERSION}+${DATE}-${TARGET}-install_only_stripped.tar.gz"
69- mkdir -p ./pyembed
70- curl -L $url | tar -xz -C ./pyembed
68+ url="https://github.com/astral-sh/python-build-standalone/releases/download/${TAG}/cpython-${PYTHON_VERSION}+${TAG}-${TARGET}-install_only_stripped.tar.gz"
69+ DEST_DIR="pyembed"
70+ mkdir "$DEST_DIR"
71+ curl -L "$url" | tar -xz -C "$DEST_DIR"
72+
73+ if [[ "${{ runner.os }}" == "macOS" ]]; then
74+ python_major_minor="${PYTHON_VERSION%.*}" # "3.13.7" -> "3.13"
75+ install_name_tool -id "@rpath/libpython${python_major_minor}.dylib" "$DEST_DIR/python/lib/libpython${python_major_minor}.dylib"
76+ fi
7177
7278 - name : install your project into the embedded python environment
7379 env :
7480 PYTAURI_STANDALONE : 1 # see your `setup.py`
81+ USE_CYTHON : 1 # see your `setup.py`
7582 PYTHON_PATH : ${{ matrix.platform == 'windows-latest' && './pyembed/python/python.exe' || './pyembed/python/bin/python3' }}
7683 run : |
7784 uv pip install \
7885 --exact \
86+ --compile-bytecode \
7987 --python=${PYTHON_PATH} \
8088 .
8189
@@ -89,11 +97,13 @@ jobs:
8997 - name : set build environment variables (linux)
9098 if : matrix.platform == 'ubuntu-22.04'
9199 shell : bash
92- # `nicegui-app` is your app `productName` in `tauri.conf.json`.
100+ env :
101+ # `nicegui-app` is your app `productName` in `tauri.conf.json`
102+ PROJECT_NAME : ' nicegui-app'
93103 run : |
94104 export PYO3_PYTHON=$(realpath ./pyembed/python/bin/python3)
95105 export RUSTFLAGS=" \
96- -C link-arg=-Wl,-rpath,\$ORIGIN/../lib/nicegui-app /lib \
106+ -C link-arg=-Wl,-rpath,\$ORIGIN/../lib/${PROJECT_NAME} /lib \
97107 -L $(realpath ./pyembed/python/lib)"
98108
99109 echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
@@ -107,7 +117,7 @@ jobs:
107117 export RUSTFLAGS=" \
108118 -C link-arg=-Wl,-rpath,@executable_path/../Resources/lib \
109119 -L $(realpath ./pyembed/python/lib)"
110-
120+
111121 echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
112122 echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
113123
0 commit comments