-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: deploy-github-page | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build-web: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install rust toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev | ||
- name: Install trunk | ||
uses: jetli/[email protected] | ||
with: | ||
version: 'latest' | ||
- name: Add wasm target | ||
run: | | ||
rustup target add wasm32-unknown-unknown | ||
- name: Build Example | ||
run: | | ||
cargo build --release --target wasm32-unknown-unknown --example window | ||
- name: Wasm bindgen | ||
run: | | ||
wasm-bindgen --no-typescript --target web --out-dir ./dist/ --out-name "httpclient" ./target/wasm32-unknown-unknown/release/examples/window.wasm | ||
- name: optimize Wasm | ||
uses: NiklasEi/wasm-opt-action@v2 | ||
with: | ||
file: dist/*.wasm | ||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/target | ||
/Cargo.lock | ||
/.idea | ||
/.vscode | ||
/.vscode | ||
|
||
dist/httpclient.js | ||
dist/httpclient_bg.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<title>Bevy http client exmaple</title> | ||
</head> | ||
<body style="margin: 0;"> | ||
<script type="module"> | ||
import init from './httpclient.js' | ||
|
||
init().catch((error) => { | ||
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) { | ||
throw error; | ||
} | ||
}); | ||
</script> | ||
<canvas id="bevy"> | ||
Javascript and support for canvas is required | ||
</canvas> | ||
</body> | ||
|
||
</html> |