Skip to content

Commit b7009e2

Browse files
author
Hyper-Fumetsu
committed
ci: wheel→deb→apt-repo — Termux pkg install 一条龙
1 parent d2d0ba2 commit b7009e2

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/build-android-wheels.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,71 @@ jobs:
8989
git diff --staged --quiet || git commit -m "➕ $PKG_NAME: $(basename $WHEEL)"
9090
git push origin wheels
9191
92+
- name: Wheel → .deb → apt repo
93+
run: |
94+
WHEEL=$(ls dist/*.whl | head -1)
95+
WHEEL_BASE=$(basename "$WHEEL" .whl)
96+
# wheel name: rpds_py-2026.6.3-cp314-cp314-android_24_arm64_v8a.whl
97+
DEB_NAME=$(echo "$WHEEL_BASE" | sed 's/_/-/g' | sed 's/cp314/python3.14/' | sed 's/android_24_arm64_v8a/aarch64/')
98+
PKG="python-$(echo "$WHEEL_BASE" | cut -d- -f1 | tr '_' '-')"
99+
VER=$(echo "$WHEEL_BASE" | cut -d- -f2)
100+
echo "DEB=$DEB_NAME PKG=$PKG VER=$VER"
101+
102+
# Extract wheel to Termux path layout
103+
TMP=$(mktemp -d)
104+
DEB_ROOT="$TMP/deb"
105+
TERMUX_PREFIX="$DEB_ROOT/data/data/com.termux/files/usr"
106+
mkdir -p "$TERMUX_PREFIX/lib/python3.14/site-packages/"
107+
mkdir -p "$DEB_ROOT/DEBIAN"
108+
109+
# Unzip wheel into site-packages
110+
python3 -m zipfile -e "$WHEEL" "$TERMUX_PREFIX/lib/python3.14/site-packages/"
111+
112+
# DEBIAN/control
113+
cat > "$DEB_ROOT/DEBIAN/control" << CTRL
114+
Package: $PKG
115+
Version: $VER
116+
Architecture: aarch64
117+
Maintainer: ClaudeCode-Termux
118+
Installed-Size: $(du -sk "$TERMUX_PREFIX" | cut -f1)
119+
Description: $PKG (auto-built from ${{ inputs.repo }})
120+
Depends: python
121+
CTRL
122+
echo "--- control ---"
123+
cat "$DEB_ROOT/DEBIAN/control"
124+
125+
sudo apt-get install -y -qq dpkg-dev
126+
DEB_FILE="dist/${DEB_NAME}.deb"
127+
sudo dpkg-deb --root-owner-group -Zxz -b "$DEB_ROOT" "$DEB_FILE"
128+
ls -lh "$DEB_FILE"
129+
130+
# Push to apt-repo branch
131+
git config --global user.name "github-actions[bot]"
132+
git config --global user.email "actions@github.com"
133+
git clone --depth 1 -b apt-repo https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git apt_repo 2>/dev/null || (
134+
git clone --depth 1 https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git apt_repo
135+
cd apt_repo && git checkout --orphan apt-repo && git rm -rf . && git commit --allow-empty -m "init apt-repo" && cd ..
136+
)
137+
cd apt_repo
138+
git checkout -b apt-repo 2>/dev/null || git checkout apt-repo
139+
140+
# Copy deb + rebuild Packages index
141+
mkdir -p pool
142+
cp "../$DEB_FILE" pool/
143+
cd pool
144+
dpkg-scanpackages --multiversion . > ../Packages
145+
cd ..
146+
gzip -9c Packages > Packages.gz
147+
148+
echo "=== apt repo: pool/ ==="
149+
ls -lh pool/
150+
echo "=== Packages ==="
151+
head -20 Packages
152+
153+
git add -A
154+
git diff --staged --quiet || git commit -m "➕ $PKG v$VER"
155+
git push origin apt-repo
156+
92157
- name: Upload artifact (backup)
93158
uses: actions/upload-artifact@v4
94159
with:

0 commit comments

Comments
 (0)