-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: GitHub Pages web demo * docs: point to hosted example * Update .github/workflows/web-demo.yml Co-authored-by: Daniel McNab <[email protected]> * build: comment updates * docs: update * ci: switch to official gh-pages action --------- Co-authored-by: Daniel McNab <[email protected]>
- Loading branch information
Showing
2 changed files
with
74 additions
and
2 deletions.
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,70 @@ | ||
name: Web Demo Update | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release-web: | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: wasm32-unknown-unknown | ||
|
||
- name: install wasm-bindgen | ||
uses: jetli/[email protected] | ||
with: | ||
version: 'latest' | ||
|
||
- name: build (wasm) | ||
run: cargo build -p with_winit --bin with_winit_bin --release --target wasm32-unknown-unknown | ||
env: | ||
RUSTFLAGS: '--cfg=web_sys_unstable_apis' | ||
|
||
- name: package wasm | ||
run: | | ||
mkdir public | ||
wasm-bindgen --target web --out-dir public target/wasm32-unknown-unknown/release/with_winit_bin.wasm --no-typescript | ||
cat << EOF > public/index.html | ||
<html> | ||
<title>Vello Web Demo</title> | ||
<meta content=no-cache http-equiv=Cache-control> | ||
<meta content=-1 http-equiv=Expires> | ||
<script type=module>import initSync from"/vello/with_winit_bin.js";initSync(`/vello/with_winit_bin_bg.wasm`);</script> | ||
<link as=fetch crossorigin href=/vello/with_winit_bin_bg.wasm rel=preload type=application/wasm> | ||
<link crossorigin href=/vello/with_winit_bin.js rel=modulepreload> | ||
</head> | ||
<body> | ||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</body> | ||
</html> | ||
EOF | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: './public' | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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