Skip to content

Commit a6784af

Browse files
authored
infra: download panels dist from release (#102)
1 parent 75e2289 commit a6784af

File tree

3 files changed

+300
-58
lines changed

3 files changed

+300
-58
lines changed

.github/workflows/release.yaml

Lines changed: 103 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,27 @@ jobs:
6666
- Only used for DevTool developers to verify branch code
6767
- May contain unstable or incomplete features' || github.ref }}
6868
69-
build-and-upload-macos:
69+
build-frontend:
7070
needs: create-release
71-
runs-on: lynx-darwin-14-medium
72-
strategy:
73-
matrix:
74-
arch: [arm64, x64]
75-
71+
runs-on: lynx-ubuntu-22.04-medium
72+
outputs:
73+
frontend_artifact_name: ${{ steps.artifact_info.outputs.artifact_name }}
74+
7675
steps:
7776
- uses: actions/checkout@v3
7877
with:
7978
submodules: recursive
8079

81-
- name: ln Python
82-
run: ln -s `which python3` /usr/local/bin/python
83-
84-
# Node and pnpm setup steps
8580
- name: Setup Node.js
8681
uses: actions/setup-node@v3
8782
with:
8883
node-version: 18.20.2
89-
84+
9085
- name: Install pnpm
9186
uses: pnpm/action-setup@v2
9287
with:
9388
version: 7.33.6
94-
89+
9590
- name: Get pnpm store directory
9691
shell: bash
9792
run: |
@@ -104,10 +99,20 @@ jobs:
10499
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
105100
restore-keys: |
106101
${{ runner.os }}-pnpm-store-
107-
102+
108103
- name: Install dependencies
109104
run: pnpm install
110105

106+
- name: Ensure python (user bin)
107+
shell: bash
108+
run: |
109+
set -euo pipefail
110+
mkdir -p "$HOME/.local/bin"
111+
PY3=$(which python3)
112+
ln -sf "$PY3" "$HOME/.local/bin/python"
113+
echo "$HOME/.local/bin" >> $GITHUB_PATH
114+
python --version
115+
111116
- name: Fetch depot_tools
112117
run: pnpm run fetch:depot_tools
113118

@@ -122,30 +127,95 @@ jobs:
122127
- name: Sync devtools-dist
123128
run: pnpm run sync:devtools-dist
124129

125-
- name: Build lynx-trace
126-
run: pnpm run build:lynx-trace
127-
128-
- name: Build all packages
129-
run: pnpm run build:all
130-
131-
# Only upload frontend once (in arm64 job)
132-
- name: Find and Upload Frontend
133-
if: matrix.arch == 'arm64'
130+
- name: Find and Upload Frontend to Release
131+
id: upload_frontend
134132
run: |
135133
ARCHIVE_PATH=$(find ./packages/devtools-frontend-lynx/output -name "devtool.frontend.lynx_1.0.*.tar.gz" | head -n 1)
136134
if [ -z "$ARCHIVE_PATH" ]; then
137135
echo "Error: Frontend archive not found"
138136
exit 1
139137
fi
138+
ARCHIVE_NAME=$(basename "$ARCHIVE_PATH")
140139
echo "Found archive at: ${ARCHIVE_PATH}"
141-
140+
echo "archive_path=${ARCHIVE_PATH}" >> $GITHUB_OUTPUT
141+
echo "archive_name=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
142+
142143
curl \
143144
-X POST \
144145
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
145146
-H "Content-Type: application/gzip" \
146147
--data-binary @"${ARCHIVE_PATH}" \
147148
"${{ needs.create-release.outputs.upload_url }}?name=devtool.frontend.lynx-${{ needs.create-release.outputs.asset_suffix }}.tar.gz"
148149
150+
- name: Upload Frontend as Artifact
151+
uses: actions/upload-artifact@v3
152+
id: artifact_info
153+
with:
154+
name: devtools-frontend-lynx
155+
path: ${{ steps.upload_frontend.outputs.archive_path }}
156+
retention-days: 1
157+
158+
build-and-upload-macos:
159+
needs: [create-release, build-frontend]
160+
runs-on: lynx-darwin-14-medium
161+
strategy:
162+
matrix:
163+
arch: [arm64, x64]
164+
165+
steps:
166+
- uses: actions/checkout@v3
167+
with:
168+
submodules: recursive
169+
170+
- name: ln Python
171+
run: ln -s `which python3` /usr/local/bin/python
172+
173+
# Node and pnpm setup steps
174+
- name: Setup Node.js
175+
uses: actions/setup-node@v3
176+
with:
177+
node-version: 18.20.2
178+
179+
- name: Install pnpm
180+
uses: pnpm/action-setup@v2
181+
with:
182+
version: 7.33.6
183+
184+
- name: Get pnpm store directory
185+
shell: bash
186+
run: |
187+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
188+
189+
- name: Setup pnpm cache
190+
uses: actions/cache@v3
191+
with:
192+
path: ${{ env.STORE_PATH }}
193+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
194+
restore-keys: |
195+
${{ runner.os }}-pnpm-store-
196+
197+
- name: Install dependencies
198+
run: pnpm install
199+
200+
- name: Download DevTools Frontend
201+
uses: actions/download-artifact@v3
202+
with:
203+
name: devtools-frontend-lynx
204+
path: temp-frontend
205+
206+
- name: Extract DevTools Frontend
207+
run: |
208+
mkdir -p packages/devtools-frontend-lynx/output
209+
ARCHIVE_PATH=$(find temp-frontend -name "devtool.frontend.lynx_*.tar.gz" | head -n 1)
210+
tar -xzf "$ARCHIVE_PATH" -C packages/devtools-frontend-lynx/output
211+
echo "DevTools Frontend extracted successfully"
212+
213+
- name: Build lynx-trace
214+
run: pnpm run build:lynx-trace
215+
216+
- name: Build all packages
217+
run: pnpm run build:all
218+
149219
- name: Install Apple Certificate
150220
if: matrix.arch == 'arm64' || matrix.arch == 'x64'
151221
env:
@@ -200,7 +270,7 @@ jobs:
200270
asset_content_type: application/x-apple-diskimage
201271

202272
build-and-upload-windows:
203-
needs: create-release
273+
needs: [create-release, build-frontend]
204274
runs-on: lynx-windows-2022-large
205275

206276
steps:
@@ -233,26 +303,19 @@ jobs:
233303
- name: Install dependencies
234304
run: pnpm install
235305

236-
- name: Fetch depot_tools
237-
run: pnpm run fetch:depot_tools
238-
239-
- name: Setup Python 3.9 (Windows)
240-
uses: actions/setup-python@v5
306+
- name: Download DevTools Frontend
307+
uses: actions/download-artifact@v3
241308
with:
242-
python-version: '3.9'
243-
architecture: 'x64'
309+
name: devtools-frontend-lynx
310+
path: temp-frontend
244311

245-
- name: Sync devtools-gn
312+
- name: Extract DevTools Frontend
246313
shell: pwsh
247314
run: |
248-
$env:PATH = "$(Get-Location)\packages\devtools-frontend-lynx\buildtools\depot_tools;$env:PATH"
249-
pnpm run sync:devtools-gn
250-
251-
- name: Build devtools-gn
252-
run: pnpm run build:devtools
253-
254-
- name: Sync devtools-dist
255-
run: pnpm run sync:devtools-dist
315+
New-Item -ItemType Directory -Force -Path "packages\devtools-frontend-lynx\output"
316+
$archivePath = Get-ChildItem -Path "temp-frontend" -Filter "devtool.frontend.lynx_*.tar.gz" | Select-Object -First 1 -ExpandProperty FullName
317+
tar -xzf "$archivePath" -C "packages\devtools-frontend-lynx\output"
318+
Write-Host "DevTools Frontend extracted successfully"
256319
257320
- name: Skip lynx-trace build on Windows
258321
run: pnpm run build:lynx-trace
@@ -284,24 +347,6 @@ jobs:
284347
- name: Build all packages
285348
run: pnpm run build:all
286349

287-
# Upload frontend (only once)
288-
- name: Find and Upload Frontend
289-
shell: pwsh
290-
run: |
291-
$archivePath = Get-ChildItem -Path ".\packages\devtools-frontend-lynx\output" -Filter "devtool.frontend.lynx_1.0.*.tar.gz" | Select-Object -First 1 -ExpandProperty FullName
292-
if (-not $archivePath) {
293-
Write-Error "Error: Frontend archive not found"
294-
exit 1
295-
}
296-
Write-Host "Found archive at: $archivePath"
297-
298-
curl.exe `
299-
-X POST `
300-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" `
301-
-H "Content-Type: application/gzip" `
302-
--data-binary "@$archivePath" `
303-
"${{ needs.create-release.outputs.upload_url }}?name=devtool.frontend.lynx-${{ needs.create-release.outputs.asset_suffix }}.tar.gz"
304-
305350
# Build Windows green package (ZIP - no installer)
306351
- name: Build Windows version
307352
shell: pwsh

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"build:all": "pnpm --filter @lynx-js/* run build && pnpm run build && pnpm run modern:renderer",
1313
"clean": "node -e \"const fs=require('fs'); ['dist', 'packages/devtools-frontend-lynx/out', 'packages/devtools-frontend-lynx/output'].forEach(p => fs.existsSync(p) && fs.rmSync(p, {recursive: true, force: true}))\" && pnpm -r exec node -e \"const fs=require('fs'); fs.existsSync('dist') && fs.rmSync('dist', {recursive: true, force: true})\"",
1414
"build:devtools-frontend-lynx": "pnpm run fetch:depot_tools && export PATH=$(pwd)/packages/devtools-frontend-lynx/buildtools/depot_tools:$PATH && pnpm run sync:devtools-gn && pnpm run build:devtools && pnpm run sync:devtools-dist",
15+
"download:devtools-frontend-lynx": "node scripts/download-devtools-frontend.js",
1516
"fetch:depot_tools": "node scripts/fetch-depot-tools.js",
1617
"sync:devtools-gn": "gclient sync --gclientfile=.gclient --deps=all",
1718
"build:devtools": "node scripts/build-lynx-devtools.js",

0 commit comments

Comments
 (0)