🤦 #6
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
name: Deploy | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
github-pages: | |
name: GitHub Pages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Update rust | |
run: rustup update stable && rustup default stable | |
- name: Install wasm-pack | |
run: cargo install wasm-pack | |
- name: Install wasm-opt | |
run: | | |
wget -O binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz | |
tar xzf binaryen.tar.gz | |
rm binaryen.tar.gz | |
mv binaryen* binaryen | |
- name: Build wasm | |
run: wasm-pack build --target web --no-default-features --features=wasm-bindgen | |
- name: Optimize wasm | |
run: ./binaryen/bin/wasm-opt -Oz pkg/hangman_solver_lib_bg.wasm -o pkg/hangman_solver_lib_bg.wasm | |
- name: Copy HTML | |
run: cp web/* pkg/ | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: pkg | |
- name: Deploy GitHub Pages site | |
id: deployment | |
uses: actions/deploy-pages@v1 |