Skip to content

Commit d9bdc45

Browse files
committed
ci: Split the web build job in the nightly release workflow into extensions and demo+selfhosted+docs
1 parent 48a78d4 commit d9bdc45

File tree

1 file changed

+136
-80
lines changed

1 file changed

+136
-80
lines changed

.github/workflows/release_nightly.yml

Lines changed: 136 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
194194
build-mac-universal-binary:
195195
name: Build macOS universal binary
196-
needs: [create-nightly-release, build, build-web]
196+
needs: [create-nightly-release, build, build-browser-extensions]
197197
runs-on: macos-14
198198
env:
199199
PACKAGE_FILE: ${{ needs.create-nightly-release.outputs.package_prefix }}-macos-universal.tar.gz
@@ -311,8 +311,11 @@ jobs:
311311
env:
312312
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
313313

314-
build-web:
315-
name: Build web${{ matrix.demo && ' demo and selfhosted' || ' extensions' }}
314+
# The first couple steps of this and the `build-web-demo-and-selfhosted` job
315+
# (tool setup and dependency install) are identical. Hopefully in the future
316+
# https://github.com/actions/runner/issues/1182 can help deduplicate them.
317+
build-browser-extensions:
318+
name: Build browser extensions
316319
needs: create-nightly-release
317320
if: needs.create-nightly-release.outputs.is_active == 'true'
318321
runs-on: ubuntu-24.04
@@ -324,9 +327,6 @@ jobs:
324327
id-token: write
325328
pull-requests: read
326329
statuses: write
327-
strategy:
328-
matrix:
329-
demo: [false, true]
330330
steps:
331331
- name: Clone Ruffle repo
332332
uses: actions/checkout@v4
@@ -362,8 +362,7 @@ jobs:
362362
- name: Install node packages
363363
working-directory: web
364364
shell: bash -l {0}
365-
run: |
366-
npm ci
365+
run: npm ci
367366

368367
- name: Seal version data
369368
shell: bash -l {0}
@@ -377,24 +376,20 @@ jobs:
377376
- name: Build web
378377
env:
379378
BUILD_ID: ${{ github.run_number }}
380-
# Build web demo with WebGPU support for testing in Chrome origin trial on ruffle.rs
381-
CARGO_FEATURES: jpegxr${{ matrix.demo && ',webgpu' || '' }}
379+
CARGO_FEATURES: jpegxr
382380
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
383381
WASM_SOURCE: cargo_and_store
384-
BUILD_COMMAND: ${{ matrix.demo && 'npm run build:dual-wasm-repro' || 'npm run build:repro' }}
385382
working-directory: web
386383
shell: bash -l {0}
387-
run: $BUILD_COMMAND
384+
run: npm run build:repro
388385

389386
- name: Produce reproducible source archive
390-
if: ${{ !matrix.demo }}
391387
shell: bash -l {0}
392388
run: |
393389
zip -r reproducible-source.zip . -x '/web/node_modules/*' '/web/*/node_modules/*' '/web/packages/*/dist/*' '/web/docker/docker_builds/packages/*' '/target/*' '/.git/*' '/tests/tests/swfs/*'
394390
cp reproducible-source.zip "${{ needs.create-nightly-release.outputs.package_prefix }}-reproducible-source.zip"
395391
396392
- name: Upload reproducible source archive
397-
if: ${{ !matrix.demo }}
398393
env:
399394
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
400395
GH_REPO: ${{ github.repository }}
@@ -403,36 +398,7 @@ jobs:
403398
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-reproducible-source.zip"
404399
gh release upload "$tag_name" "$package_file"
405400
406-
- name: Build web docs
407-
working-directory: web
408-
run: npm run docs
409-
410-
- name: Publish npm package
411-
if: matrix.demo
412-
# npm scoped packages are private by default, explicitly make public
413-
run: npm publish --access public --provenance
414-
continue-on-error: true
415-
working-directory: web/packages/selfhosted/dist
416-
env:
417-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
418-
419-
- name: Package selfhosted
420-
if: matrix.demo
421-
run: zip -r "${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip" .
422-
working-directory: web/packages/selfhosted/dist
423-
424-
- name: Upload selfhosted
425-
if: matrix.demo
426-
run: |
427-
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
428-
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip"
429-
gh release upload "$tag_name" "$package_file"
430-
working-directory: web/packages/selfhosted/dist
431-
env:
432-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
433-
434401
- name: Upload generic extension
435-
if: ${{ !matrix.demo }}
436402
run: |
437403
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
438404
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension.zip"
@@ -443,14 +409,12 @@ jobs:
443409
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
444410

445411
- name: Upload Safari build artifact
446-
if: ${{ !matrix.demo }}
447412
uses: actions/upload-artifact@v4
448413
with:
449414
name: macos-safari
450415
path: ./web/packages/extension/dist/ruffle_extension.zip
451416

452417
- name: Upload Firefox extension (unsigned)
453-
if: ${{ !matrix.demo }}
454418
run: |
455419
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
456420
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension-firefox-unsigned.xpi"
@@ -461,7 +425,7 @@ jobs:
461425
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
462426

463427
- name: Publish Chrome extension
464-
if: env.CHROME_EXTENSION_ID != '' && !matrix.demo
428+
if: env.CHROME_EXTENSION_ID != ''
465429
id: publish-chrome-extension
466430
continue-on-error: true
467431
env:
@@ -475,7 +439,7 @@ jobs:
475439
file-path: ./web/packages/extension/dist/ruffle_extension.zip
476440

477441
- name: Publish Edge extension
478-
if: env.EDGE_PRODUCT_ID != '' && !matrix.demo
442+
if: env.EDGE_PRODUCT_ID != ''
479443
id: publish-edge-extension
480444
continue-on-error: true
481445
env:
@@ -487,46 +451,103 @@ jobs:
487451
client-id: ${{ secrets.EDGE_CLIENT_ID }}
488452
api-key: ${{ secrets.EDGE_API_KEY }}
489453

490-
- name: Clone web demo
491-
if: matrix.demo
454+
build-web-demo-and-selfhosted:
455+
name: Build web demo and selfhosted package with docs
456+
needs: create-nightly-release
457+
if: needs.create-nightly-release.outputs.is_active == 'true'
458+
runs-on: ubuntu-24.04
459+
permissions:
460+
actions: read
461+
attestations: write
462+
checks: read
463+
contents: write
464+
id-token: write
465+
pull-requests: read
466+
statuses: write
467+
steps:
468+
- name: Clone Ruffle repo
492469
uses: actions/checkout@v4
470+
471+
- name: Install Rust toolchain
472+
uses: dtolnay/rust-toolchain@stable
493473
with:
494-
repository: ruffle-rs/demo
495-
path: demo
496-
ref: master
497-
fetch-depth: 0
498-
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below
474+
toolchain: stable
475+
targets: wasm32-unknown-unknown
476+
components: rust-src
499477

500-
- name: Update web demo
501-
if: matrix.demo
502-
run: |
503-
# Delete the old build.
504-
rm -fr *
478+
- name: Setup Node.js
479+
uses: actions/setup-node@v4
480+
with:
481+
node-version: "22"
482+
registry-url: https://registry.npmjs.org
505483

506-
# Copy the fresh build into this folder.
507-
cp -fr ../web/packages/demo/dist/* .
484+
# wasm-bindgen-cli version must match wasm-bindgen crate version.
485+
# Be sure to update in test_web.yml, Cargo.toml, web/docker/Dockerfile,
486+
# and web/README.md as well.
487+
- name: Install wasm-bindgen
488+
run: cargo install wasm-bindgen-cli --version 0.2.100
508489

509-
# Restore our custom swfs
510-
git restore swfs swfs.json
490+
# Keep the version number in sync in all workflows,
491+
# and in the extension builder Dockerfile!
492+
- name: Install wasm-opt
493+
uses: sigoden/install-binary@v1
494+
with:
495+
repo: WebAssembly/binaryen
496+
tag: version_123
497+
name: wasm-opt
511498

512-
# Create git commit. Amend previous commit to avoid daily commit spam.
513-
git config user.name "RuffleBuild"
514-
git config user.email "[email protected]"
515-
git add -A
516-
git commit --amend -m "Nightly build ${{ needs.create-nightly-release.outputs.date }}"
517-
working-directory: demo
499+
- name: Install node packages
500+
working-directory: web
501+
shell: bash -l {0}
502+
run: npm ci
518503

519-
- name: Push web demo
520-
if: github.repository == 'ruffle-rs/ruffle' && matrix.demo
521-
uses: ad-m/github-push-action@master
522-
with:
523-
repository: ruffle-rs/demo
524-
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
525-
directory: demo
526-
force: true
504+
- name: Seal version data
505+
shell: bash -l {0}
506+
working-directory: web
507+
env:
508+
BUILD_ID: ${{ github.run_number }}
509+
ENABLE_VERSION_SEAL: "true"
510+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
511+
run: npm run version-seal
512+
513+
- name: Build web
514+
env:
515+
BUILD_ID: ${{ github.run_number }}
516+
# NOTE: In the future, we might want to enable some features (like `webgpu`) only in
517+
# the demo build, for limited testing (like a Chrome origin trial) on ruffle.rs.
518+
CARGO_FEATURES: jpegxr
519+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
520+
WASM_SOURCE: cargo_and_store
521+
working-directory: web
522+
shell: bash -l {0}
523+
run: npm run build:repro
524+
525+
- name: Build web docs
526+
working-directory: web
527+
run: npm run docs
528+
529+
- name: Publish npm package
530+
# npm scoped packages are private by default, explicitly make public
531+
run: npm publish --access public --provenance
532+
continue-on-error: true
533+
working-directory: web/packages/selfhosted/dist
534+
env:
535+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
536+
537+
- name: Package selfhosted
538+
run: zip -r "${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip" .
539+
working-directory: web/packages/selfhosted/dist
540+
541+
- name: Upload selfhosted
542+
run: |
543+
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
544+
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip"
545+
gh release upload "$tag_name" "$package_file"
546+
working-directory: web/packages/selfhosted/dist
547+
env:
548+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
527549

528550
- name: Clone JS docs
529-
if: ${{ !matrix.demo }}
530551
uses: actions/checkout@v4
531552
with:
532553
repository: ruffle-rs/js-docs
@@ -536,7 +557,6 @@ jobs:
536557
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below
537558

538559
- name: Update JS docs
539-
if: ${{ !matrix.demo }}
540560
run: |
541561
# Delete the old docs
542562
rm -rf master/
@@ -552,14 +572,50 @@ jobs:
552572
working-directory: js-docs
553573

554574
- name: Push JS docs
555-
if: github.repository == 'ruffle-rs/ruffle' && !matrix.demo
575+
if: github.repository == 'ruffle-rs/ruffle'
556576
uses: ad-m/github-push-action@master
557577
with:
558578
repository: ruffle-rs/js-docs
559579
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
560580
directory: js-docs
561581
force: true
562582

583+
- name: Clone web demo
584+
uses: actions/checkout@v4
585+
with:
586+
repository: ruffle-rs/demo
587+
path: demo
588+
ref: master
589+
fetch-depth: 0
590+
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below
591+
592+
- name: Update web demo
593+
run: |
594+
# Delete the old build.
595+
rm -fr *
596+
597+
# Copy the fresh build into this folder.
598+
cp -fr ../web/packages/demo/dist/* .
599+
600+
# Restore our custom swfs
601+
git restore swfs swfs.json
602+
603+
# Create git commit. Amend previous commit to avoid daily commit spam.
604+
git config user.name "RuffleBuild"
605+
git config user.email "[email protected]"
606+
git add -A
607+
git commit --amend -m "Nightly build ${{ needs.create-nightly-release.outputs.date }}"
608+
working-directory: demo
609+
610+
- name: Push web demo
611+
if: github.repository == 'ruffle-rs/ruffle'
612+
uses: ad-m/github-push-action@master
613+
with:
614+
repository: ruffle-rs/demo
615+
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
616+
directory: demo
617+
force: true
618+
563619
publish-aur-package:
564620
name: Publish AUR package
565621
needs: [create-nightly-release, build]

0 commit comments

Comments
 (0)