Skip to content

Commit 85f3b23

Browse files
committed
ci(release): install OpenTUI platform packages for cross builds
Fix v0.1.5 release packaging by fetching @opentui/core-<platform>-<arch> modules (linux-arm64, darwin-x64) so bun --compile can bundle them without needing those runner architectures.
1 parent 3b43d0b commit 85f3b23

1 file changed

Lines changed: 60 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,27 @@ jobs:
8484
bun_target: bun-linux-x64
8585
platform: linux-x64
8686
exe: roboppi
87-
- os: ubuntu-24.04-arm64
87+
opentui_pkg: ""
88+
- os: ubuntu-latest
8889
bun_target: bun-linux-arm64
8990
platform: linux-arm64
9091
exe: roboppi
92+
opentui_pkg: "@opentui/core-linux-arm64"
9193
- os: macos-latest
9294
bun_target: bun-darwin-arm64
9395
platform: macos-arm64
9496
exe: roboppi
95-
- os: macos-13
97+
opentui_pkg: ""
98+
- os: macos-latest
9699
bun_target: bun-darwin-x64
97100
platform: macos-x64
98101
exe: roboppi
102+
opentui_pkg: "@opentui/core-darwin-x64"
99103
- os: windows-latest
100104
bun_target: bun-windows-x64
101105
platform: windows-x64
102106
exe: roboppi.exe
107+
opentui_pkg: ""
103108

104109
runs-on: ${{ matrix.os }}
105110
steps:
@@ -117,6 +122,59 @@ jobs:
117122
- name: Install dependencies
118123
run: bun install --frozen-lockfile
119124

125+
- name: Install OpenTUI platform package (for cross builds)
126+
if: ${{ matrix.opentui_pkg != '' }}
127+
shell: bash
128+
env:
129+
PKG: ${{ matrix.opentui_pkg }}
130+
run: |
131+
set -euo pipefail
132+
133+
VER=$(node -e "const p=require('./package.json'); process.stdout.write(String((p.dependencies||{})['@opentui/core']||''));")
134+
if [[ -z "$VER" ]]; then
135+
echo "@opentui/core version not found in package.json" >&2
136+
exit 1
137+
fi
138+
139+
TARBALL=$(VER="$VER" python - <<'PY'
140+
import json
141+
import os
142+
import urllib.request
143+
import urllib.parse
144+
145+
pkg = os.environ['PKG']
146+
ver = os.environ['VER']
147+
148+
meta_url = 'https://registry.npmjs.org/' + urllib.parse.quote(pkg, safe='')
149+
with urllib.request.urlopen(meta_url) as r:
150+
meta = json.load(r)
151+
152+
try:
153+
tarball = meta['versions'][ver]['dist']['tarball']
154+
except Exception as e:
155+
raise SystemExit(f'could not resolve tarball for {pkg}@{ver}: {e}')
156+
157+
print(tarball)
158+
PY
159+
)
160+
161+
echo "Installing $PKG@$VER from $TARBALL" >&2
162+
163+
rm -f /tmp/opentui-pkg.tgz
164+
curl -fsSL "$TARBALL" -o /tmp/opentui-pkg.tgz
165+
166+
SCOPE=$(node -e "const s=process.env.PKG; process.stdout.write(s.startsWith('@')?s.split('/')[0].slice(1):'');")
167+
NAME=$(node -e "const s=process.env.PKG; process.stdout.write(s.startsWith('@')?s.split('/')[1]:s);")
168+
169+
if [[ -z "$SCOPE" || -z "$NAME" ]]; then
170+
echo "Could not parse scoped package name: $PKG" >&2
171+
exit 1
172+
fi
173+
174+
DEST="node_modules/@${SCOPE}/${NAME}"
175+
mkdir -p "$DEST"
176+
tar -xzf /tmp/opentui-pkg.tgz -C "$DEST" --strip-components=1 package
177+
120178
- name: Build standalone binary
121179
shell: bash
122180
run: |

0 commit comments

Comments
 (0)