Skip to content

Commit 3299304

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

File tree

1 file changed

+132
-76
lines changed

1 file changed

+132
-76
lines changed

.github/workflows/release_nightly.yml

Lines changed: 132 additions & 76 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,8 @@ jobs:
311311
env:
312312
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
313313

314-
build-web:
315-
name: Build web${{ matrix.demo && ' demo and selfhosted' || ' extensions' }}
314+
build-browser-extensions:
315+
name: Build browser extensions
316316
needs: create-nightly-release
317317
if: needs.create-nightly-release.outputs.is_active == 'true'
318318
runs-on: ubuntu-24.04
@@ -324,9 +324,6 @@ jobs:
324324
id-token: write
325325
pull-requests: read
326326
statuses: write
327-
strategy:
328-
matrix:
329-
demo: [false, true]
330327
steps:
331328
- name: Clone Ruffle repo
332329
uses: actions/checkout@v4
@@ -362,8 +359,7 @@ jobs:
362359
- name: Install node packages
363360
working-directory: web
364361
shell: bash -l {0}
365-
run: |
366-
npm ci
362+
run: npm ci
367363

368364
- name: Seal version data
369365
shell: bash -l {0}
@@ -377,24 +373,20 @@ jobs:
377373
- name: Build web
378374
env:
379375
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' || '' }}
376+
CARGO_FEATURES: jpegxr
382377
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
383378
WASM_SOURCE: cargo_and_store
384-
BUILD_COMMAND: ${{ matrix.demo && 'npm run build:dual-wasm-repro' || 'npm run build:repro' }}
385379
working-directory: web
386380
shell: bash -l {0}
387-
run: $BUILD_COMMAND
381+
run: npm run build:repro
388382

389383
- name: Produce reproducible source archive
390-
if: ${{ !matrix.demo }}
391384
shell: bash -l {0}
392385
run: |
393386
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/*'
394387
cp reproducible-source.zip "${{ needs.create-nightly-release.outputs.package_prefix }}-reproducible-source.zip"
395388
396389
- name: Upload reproducible source archive
397-
if: ${{ !matrix.demo }}
398390
env:
399391
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
400392
GH_REPO: ${{ github.repository }}
@@ -407,32 +399,7 @@ jobs:
407399
working-directory: web
408400
run: npm run docs
409401

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-
434402
- name: Upload generic extension
435-
if: ${{ !matrix.demo }}
436403
run: |
437404
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
438405
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension.zip"
@@ -443,14 +410,12 @@ jobs:
443410
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
444411

445412
- name: Upload Safari build artifact
446-
if: ${{ !matrix.demo }}
447413
uses: actions/upload-artifact@v4
448414
with:
449415
name: macos-safari
450416
path: ./web/packages/extension/dist/ruffle_extension.zip
451417

452418
- name: Upload Firefox extension (unsigned)
453-
if: ${{ !matrix.demo }}
454419
run: |
455420
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
456421
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension-firefox-unsigned.xpi"
@@ -461,7 +426,7 @@ jobs:
461426
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
462427

463428
- name: Publish Chrome extension
464-
if: env.CHROME_EXTENSION_ID != '' && !matrix.demo
429+
if: env.CHROME_EXTENSION_ID != ''
465430
id: publish-chrome-extension
466431
continue-on-error: true
467432
env:
@@ -475,7 +440,7 @@ jobs:
475440
file-path: ./web/packages/extension/dist/ruffle_extension.zip
476441

477442
- name: Publish Edge extension
478-
if: env.EDGE_PRODUCT_ID != '' && !matrix.demo
443+
if: env.EDGE_PRODUCT_ID != ''
479444
id: publish-edge-extension
480445
continue-on-error: true
481446
env:
@@ -487,46 +452,102 @@ jobs:
487452
client-id: ${{ secrets.EDGE_CLIENT_ID }}
488453
api-key: ${{ secrets.EDGE_API_KEY }}
489454

490-
- name: Clone web demo
491-
if: matrix.demo
455+
build-web-demo-and-selfhosted:
456+
name: Build web demo and selfhosted package with docs
457+
needs: create-nightly-release
458+
if: needs.create-nightly-release.outputs.is_active == 'true'
459+
runs-on: ubuntu-24.04
460+
permissions:
461+
actions: read
462+
attestations: write
463+
checks: read
464+
contents: write
465+
id-token: write
466+
pull-requests: read
467+
statuses: write
468+
steps:
469+
- name: Clone Ruffle repo
492470
uses: actions/checkout@v4
471+
472+
- name: Install Rust toolchain
473+
uses: dtolnay/rust-toolchain@stable
493474
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
475+
toolchain: stable
476+
targets: wasm32-unknown-unknown
477+
components: rust-src
499478

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

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

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

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
500+
- name: Install node packages
501+
working-directory: web
502+
shell: bash -l {0}
503+
run: npm ci
518504

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
505+
- name: Seal version data
506+
shell: bash -l {0}
507+
working-directory: web
508+
env:
509+
BUILD_ID: ${{ github.run_number }}
510+
ENABLE_VERSION_SEAL: "true"
511+
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
512+
run: npm run version-seal
513+
514+
- name: Build web
515+
env:
516+
BUILD_ID: ${{ github.run_number }}
517+
# Build web demo with WebGPU support for testing in Chrome origin trial on ruffle.rs
518+
CARGO_FEATURES: jpegxr,webgpu
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)