name: Deploy ImGui WASM to GitHub Pages on: push: branches: [master] paths: - 'imgui.cpp' - 'imgui.h' - 'imgui_demo.cpp' - 'imgui_draw.cpp' - 'imgui_tables.cpp' - 'imgui_widgets.cpp' - 'backends/imgui_impl_sdl2.*' - 'backends/imgui_impl_opengl3.*' - 'examples/example_sdl2_opengl3/main.cpp' - 'examples/example_sdl2_opengl3/Makefile.emscripten' - 'examples/libs/emscripten/**' - '.github/workflows/deploy-wasm.yml' workflow_dispatch: permissions: contents: write pages: write jobs: build-and-deploy: runs-on: ubuntu-latest name: Build ImGui WASM and deploy to gh-pages steps: - name: Checkout imgui_xl uses: actions/checkout@v6 - name: Install Emscripten run: | wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz tar -xzf master.tar.gz emsdk-master/emsdk update emsdk-master/emsdk install latest emsdk-master/emsdk activate latest sudo apt-get install build-essential - name: Build SDL2+OpenGL3 ImGui WASM run: | pushd emsdk-master source ./emsdk_env.sh popd # Build with custom shell file (single-file mode: all WASM embedded in one .html) # We sed the Makefile to use our custom shell and enable SINGLE_FILE cd examples/example_sdl2_opengl3 sed -i 's|--shell-file ../libs/emscripten/shell_minimal.html|--shell-file ../libs/emscripten/shell_imgui_xl.html|' Makefile.emscripten sed -i 's|#LDFLAGS += -sSINGLE_FILE|LDFLAGS += -sSINGLE_FILE|' Makefile.emscripten make -f Makefile.emscripten -j$(nproc) # Verify output echo "=== Build output ===" ls -la web/ echo "=== File size ===" du -sh web/index.html - name: Deploy to gh-pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: gh-pages publish_dir: examples/example_sdl2_opengl3/web destination_dir: wasm keep_files: true