diff --git a/.github/workflows/build-html5.yml b/.github/workflows/build-html5.yml index 5a604e0..3960b8d 100644 --- a/.github/workflows/build-html5.yml +++ b/.github/workflows/build-html5.yml @@ -46,31 +46,20 @@ jobs: - name: Compile native lib for wasm uses: actions-rs/cargo@v1 with: + toolchain: nightly-2023-11-10 command: build args: --manifest-path source/native/Cargo.toml --target wasm32-unknown-emscripten --release env: - RUSTFLAGS: -C link-args=-fPIC -C relocation-model=pic -C target-feature=+mutable-globals - EMMAKEN_CFLAGS: -s SIDE_MODULE=1 -shared -Os C_INCLUDE_PATH: ${{env.EMSDK}}/upstream/emscripten/cache/sysroot/include/ CARGO_TARGET_DIR: source/native/target - # Optimize for size - CARGO_PROFILE_RELEASE_OPT_LEVEL: s - # No overflow check / assertions - CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS: false - CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: false - # Don't unwind the stack - CARGO_PROFILE_RELEASE_PANIC: abort - # Use my wrapper to extract the rlib - CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER: ${{github.workspace}}/source/native/emcc/emcc-test - name: Build run: | mkdir -v -p exports/web godot -v --export "HTML5" exports/web/${EXPORT_NAME}.html - - name: Upload Artifact - uses: actions/upload-artifact@v2 + - name: Publish Game + uses: peaceiris/actions-gh-pages@v3 with: - name: HTML5 - path: exports/web - retention-days: 7 + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./exports/web diff --git a/source/native/.cargo/config.toml b/source/native/.cargo/config.toml new file mode 100644 index 0000000..8524f4d --- /dev/null +++ b/source/native/.cargo/config.toml @@ -0,0 +1,6 @@ +[target.wasm32-unknown-emscripten] +rustflags = [ + "-Clink-arg=-sSIDE_MODULE=2", # build a side module that Godot can load + "-Clink-native-libraries=no", # workaround for a wasm-ld error during linking + "-Cpanic=abort", # workaround for a runtime error related to dyncalls +]