diff --git a/.github/workflows/deploy-page.yaml b/.github/workflows/deploy-page.yaml new file mode 100644 index 0000000..3a4bdf8 --- /dev/null +++ b/.github/workflows/deploy-page.yaml @@ -0,0 +1,46 @@ +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/trunk-action@v0.4.0 + # with: + # version: 'latest' + - name: Install wasm-bindgen + run: | + cargo install wasm-bindgen-cli + - name: Add wasm target + run: | + rustup target add wasm32-unknown-unknown + - name: Build Example + run: | + cargo build --release --target wasm32-unknown-unknown + - name: Wasm bindgen + run: | + wasm-bindgen --no-typescript --target web --out-dir ./dist/ --out-name "jigsaw_puzzle" ./target/wasm32-unknown-unknown/release/jigsaw_puzzle.wasm + - name: optimize Wasm + uses: NiklasEi/wasm-opt-action@v2 + with: + file: dist/*.wasm + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + branch: gh-pages + folder: dist \ No newline at end of file diff --git a/.gitignore b/.gitignore index cd40970..c1dc56d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ Cargo.lock /tiles /images -jigsaw_puzzle_generator/target \ No newline at end of file +jigsaw_puzzle_generator/target +dist/* +!dist/index.html \ No newline at end of file diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..2b86d41 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,23 @@ + + +
+ + +