From 32f2ad454195ce7024612915e0f231cb21b18631 Mon Sep 17 00:00:00 2001 From: vladbat00 Date: Sun, 5 Jan 2025 15:35:46 +0200 Subject: [PATCH] Auto-deploy examples to GitHub Pages --- .github/workflows/check.yml | 2 +- .github/workflows/deploy_examples.yml | 54 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy_examples.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6f096d0a..891f913a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ jobs: name: Formatter check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: nightly diff --git a/.github/workflows/deploy_examples.yml b/.github/workflows/deploy_examples.yml new file mode 100644 index 00000000..c880a024 --- /dev/null +++ b/.github/workflows/deploy_examples.yml @@ -0,0 +1,54 @@ +on: + push: + tags: + - '*' + +name: Build and deploy examples + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Reset to the latest tag + run: git reset --hard $(git describe --tags --abbrev=0) + + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: wasm32-unknown-unknown + + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + + - name: Install dependencies + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev + + - name: Install bevy_cli + run: cargo install --git https://github.com/TheBevyFlock/bevy_cli bevy_cli + + - name: Build color_test + run: bevy build --example color_test web --bundle + - name: Build paint_callback + run: bevy build --example paint_callback web --bundle + - name: Build render_egui_to_image + run: bevy build --example render_egui_to_image web --bundle + - name: Build render_to_image_widget + run: bevy build --example render_to_image_widget web --bundle + - name: Build side_panel + run: bevy build --example side_panel web --bundle + - name: Build simple + run: bevy build --example simple web --bundle + - name: Build simple_multipass + run: bevy build --example simple_multipass web --bundle + # We skip the two_windows example as it's not supported in WASM + - name: Build ui + run: bevy build --example ui web --bundle + + - name: Upload the artifacts + uses: actions/upload-pages-artifact@v2 + with: + path: 'target/bevy_web/web'