Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 135 additions & 78 deletions .github/workflows/release_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:

build-mac-universal-binary:
name: Build macOS universal binary
needs: [create-nightly-release, build, build-web]
needs: [create-nightly-release, build, build-browser-extensions]
runs-on: macos-14
env:
PACKAGE_FILE: ${{ needs.create-nightly-release.outputs.package_prefix }}-macos-universal.tar.gz
Expand Down Expand Up @@ -311,8 +311,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

- name: Seal version data
shell: bash -l {0}
Expand All @@ -377,23 +376,20 @@ jobs:
- name: Build web
env:
BUILD_ID: ${{ github.run_number }}
# Build web demo with WebGPU support for testing in Chrome origin trial on ruffle.rs
CARGO_FEATURES: jpegxr${{ matrix.demo && ',webgpu' || '' }}
CARGO_FEATURES: jpegxr
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
WASM_SOURCE: cargo_and_store
working-directory: web
shell: bash -l {0}
run: npm run build:repro

- name: Produce reproducible source archive
if: ${{ !matrix.demo }}
shell: bash -l {0}
run: |
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/*'
cp reproducible-source.zip "${{ needs.create-nightly-release.outputs.package_prefix }}-reproducible-source.zip"

- name: Upload reproducible source archive
if: ${{ !matrix.demo }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
Expand All @@ -402,36 +398,7 @@ jobs:
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-reproducible-source.zip"
gh release upload "$tag_name" "$package_file"

- name: Build web docs
working-directory: web
run: npm run docs

- name: Publish npm package
if: ${{ !matrix.demo }}
# npm scoped packages are private by default, explicitly make public
run: npm publish --access public --provenance
continue-on-error: true
working-directory: web/packages/selfhosted/dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Package selfhosted
if: ${{ !matrix.demo }}
run: zip -r "${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip" .
working-directory: web/packages/selfhosted/dist

- name: Upload selfhosted
if: ${{ !matrix.demo }}
run: |
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip"
gh release upload "$tag_name" "$package_file"
working-directory: web/packages/selfhosted/dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload generic extension
if: ${{ !matrix.demo }}
run: |
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension.zip"
Expand All @@ -442,14 +409,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

- name: Upload Firefox extension (unsigned)
if: ${{ !matrix.demo }}
run: |
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-extension-firefox-unsigned.xpi"
Expand All @@ -460,7 +425,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Chrome extension
if: env.CHROME_EXTENSION_ID != '' && !matrix.demo
if: env.CHROME_EXTENSION_ID != ''
id: publish-chrome-extension
continue-on-error: true
env:
Expand All @@ -474,7 +439,7 @@ jobs:
file-path: ./web/packages/extension/dist/ruffle_extension.zip

- name: Publish Edge extension
if: env.EDGE_PRODUCT_ID != '' && !matrix.demo
if: env.EDGE_PRODUCT_ID != ''
id: publish-edge-extension
continue-on-error: true
env:
Expand All @@ -486,46 +451,103 @@ jobs:
client-id: ${{ secrets.EDGE_CLIENT_ID }}
api-key: ${{ secrets.EDGE_API_KEY }}

- name: Clone web demo
if: matrix.demo
build-web-demo-and-selfhosted:
name: Build web demo and selfhosted package with docs
needs: create-nightly-release
if: needs.create-nightly-release.outputs.is_active == 'true'
runs-on: ubuntu-24.04
permissions:
actions: read
attestations: write
checks: read
contents: write
id-token: write
pull-requests: read
statuses: write
steps:
- name: Clone Ruffle repo
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
repository: ruffle-rs/demo
path: demo
ref: master
fetch-depth: 0
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below
toolchain: stable
targets: wasm32-unknown-unknown
components: rust-src

- name: Update web demo
if: matrix.demo
run: |
# Delete the old build.
rm -fr *
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: https://registry.npmjs.org

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

# Restore our custom swfs
git restore swfs swfs.json
# Keep the version number in sync in all workflows,
# and in the extension builder Dockerfile!
- name: Install wasm-opt
uses: sigoden/install-binary@v1
with:
repo: WebAssembly/binaryen
tag: version_123
name: wasm-opt

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

- name: Push web demo
if: github.repository == 'ruffle-rs/ruffle' && matrix.demo
uses: ad-m/github-push-action@master
with:
repository: ruffle-rs/demo
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
directory: demo
force: true
- name: Seal version data
shell: bash -l {0}
working-directory: web
env:
BUILD_ID: ${{ github.run_number }}
ENABLE_VERSION_SEAL: "true"
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
run: npm run version-seal

- name: Build web
env:
BUILD_ID: ${{ github.run_number }}
# NOTE: In the future, we might want to enable some features (like `webgpu`) only in
# the demo build, for limited testing (like a Chrome origin trial) on ruffle.rs.
CARGO_FEATURES: jpegxr
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
WASM_SOURCE: cargo_and_store
working-directory: web
shell: bash -l {0}
run: npm run build:repro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        run: npm run build:dual-wasm-repro


- name: Build web docs
working-directory: web
run: npm run docs

- name: Publish npm package
# npm scoped packages are private by default, explicitly make public
run: npm publish --access public --provenance
continue-on-error: true
working-directory: web/packages/selfhosted/dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Package selfhosted
run: zip -r "${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip" .
working-directory: web/packages/selfhosted/dist

- name: Upload selfhosted
run: |
tag_name="${{ needs.create-nightly-release.outputs.tag_name }}"
package_file="${{ needs.create-nightly-release.outputs.package_prefix }}-web-selfhosted.zip"
gh release upload "$tag_name" "$package_file"
working-directory: web/packages/selfhosted/dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Clone JS docs
if: ${{ !matrix.demo }}
uses: actions/checkout@v4
with:
repository: ruffle-rs/js-docs
Expand All @@ -535,7 +557,6 @@ jobs:
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below

- name: Update JS docs
if: ${{ !matrix.demo }}
run: |
# Delete the old docs
rm -rf master/
Expand All @@ -551,14 +572,50 @@ jobs:
working-directory: js-docs

- name: Push JS docs
if: github.repository == 'ruffle-rs/ruffle' && !matrix.demo
if: github.repository == 'ruffle-rs/ruffle'
uses: ad-m/github-push-action@master
with:
repository: ruffle-rs/js-docs
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
directory: js-docs
force: true

- name: Clone web demo
uses: actions/checkout@v4
with:
repository: ruffle-rs/demo
path: demo
ref: master
fetch-depth: 0
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below

- name: Update web demo
run: |
# Delete the old build.
rm -fr *

# Copy the fresh build into this folder.
cp -fr ../web/packages/demo/dist/* .

# Restore our custom swfs
git restore swfs swfs.json

# Create git commit. Amend previous commit to avoid daily commit spam.
git config user.name "RuffleBuild"
git config user.email "[email protected]"
git add -A
git commit --amend -m "Nightly build ${{ needs.create-nightly-release.outputs.date }}"
working-directory: demo

- name: Push web demo
if: github.repository == 'ruffle-rs/ruffle'
uses: ad-m/github-push-action@master
with:
repository: ruffle-rs/demo
github_token: ${{ secrets.RUFFLE_BUILD_TOKEN }}
directory: demo
force: true

publish-aur-package:
name: Publish AUR package
needs: [create-nightly-release, build]
Expand Down
5 changes: 3 additions & 2 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ In this project, you may run the following commands to build all packages:
- You may also use `npm run build:debug` to disable Webpack optimizations and activate the (extremely verbose) ActionScript debugging output.
- There is `npm run build:dual-wasm` as well, to build a second WebAssembly module that disables all supported WebAssembly extensions,
potentially resulting in support for more browsers, at the expense of longer build time.
- `npm run build:repro` enables reproducible builds. Note that this also requires a `version_seal.json`, which is not provided in the normal Git repository - only specially-marked reproducible source archives. Running this without a version seal will generate one based on the current state of your environment.
- You will also need to run `rustup component add rust-src` with either of the previous two commands since we rebuild std for the vanilla WASM module.
- `npm run build:repro` enables reproducible builds with the default WASM module. Note that this also requires a `version_seal.json`, which is not provided in the normal Git repository - only specially-marked reproducible source archives. Running this without a version seal will generate one based on the current state of your environment.
- `npm run build:dual-wasm-repro` enables reproducible builds with both WASM modules. Note that this also requires a `version_seal.json`, which is not provided in the normal Git repository - only specially-marked reproducible source archives. Running this without a version seal will generate one based on the current state of your environment.
- You will also need to run `rustup component add rust-src` with either of the dual-wasm commands since we rebuild std for the vanilla WASM module.

From here, you may follow the instructions to [use Ruffle on your website](packages/selfhosted/README.md),
run a demo locally with `npm run demo`, or [install the extension in your browser](https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#browser-extension).
Expand Down
3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"build": "npm run build --workspace=ruffle-core && npm run build --workspace=ruffle-demo --workspace=ruffle-extension --workspace=ruffle-selfhosted",
"build:debug": "cross-env NODE_ENV=development CARGO_FEATURES=avm_debug npm run build",
"build:dual-wasm": "cross-env BUILD_WASM_MVP=true npm run build",
"build:repro": "cross-env BUILD_WASM_MVP=true ENABLE_VERSION_SEAL=true npm run build",
"build:repro": "cross-env ENABLE_VERSION_SEAL=true npm run build",
"build:dual-wasm-repro": "cross-env BUILD_WASM_MVP=true ENABLE_VERSION_SEAL=true npm run build",
"demo": "npm run preview --workspace ruffle-demo",
"test": "npm test --workspaces --if-present",
"wdio": "npm run wdio --workspaces --if-present --",
Expand Down
Loading