From 5598a53a5366548002f0258ba715897f4029348a Mon Sep 17 00:00:00 2001 From: Nicolas Meylan Date: Sat, 29 Jun 2024 21:23:33 +0200 Subject: [PATCH] Add ci for github page --- .github/workflows/deploy_web_demo.yml | 51 +++++++++++++++++++++++++++ scripts/build_web.sh | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_web_demo.yml diff --git a/.github/workflows/deploy_web_demo.yml b/.github/workflows/deploy_web_demo.yml new file mode 100644 index 0000000..58fb851 --- /dev/null +++ b/.github/workflows/deploy_web_demo.yml @@ -0,0 +1,51 @@ +name: Deploy web demo + +on: + release: + types: ["published"] + + +permissions: + contents: write # for committing to gh-pages branch + +concurrency: + group: "pages" + cancel-in-progress: false + +env: + RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings + RUSTDOCFLAGS: -D warnings + +jobs: + # Single deploy job since we're just deploying + deploy: + name: Deploy web demo + + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + target: wasm32-unknown-unknown + toolchain: 1.76.0 + override: true + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: "web-demo-" + + - name: "Install wasmopt / binaryen" + run: | + sudo apt-get update && sudo apt-get install binaryen + + - run: | + scripts/build_web.sh + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: web_demo + single-commit: true diff --git a/scripts/build_web.sh b/scripts/build_web.sh index ca83e77..18770ae 100644 --- a/scripts/build_web.sh +++ b/scripts/build_web.sh @@ -15,7 +15,7 @@ CRATE_NAME="json-editor" FEATURES="all-features" OPEN=false -OPTIMIZE=false +OPTIMIZE=true BUILD=release BUILD_FLAGS="--release" WGPU=true