build-github-page #4
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: build-github-page | |
on: [workflow_dispatch] | |
# on: [push, workflow_dispatch] | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
# defaults: | |
# run: | |
# shell: bash | |
# working-directory: crates/gbpplanner-rs | |
jobs: | |
install-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: install apt dependencies | |
run: sudo apt-get update; sudo apt-get install -y pkg-config libx11-dev libasound2-dev libudev-dev # libfreetype6-dev libfontconfig1-dev | |
- name: install mold linker | |
uses: rui314/setup-mold@v1 | |
- name: install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
# targets: wasm32-unknown-unknown | |
toolchain: stable | |
- name: Add wasm target | |
run: rustup target add wasm32-unknown-unknown | |
- name: install trunk | |
uses: jetli/trunk-action@v0.5.0 | |
with: | |
version: 'latest' | |
- name: Build wasm binary | |
run: | | |
trunk build --release --public-url /${{ github.event.repository.name }} | |
working-directory: crates/gbpplanner-rs | |
- name: optimize Wasm | |
uses: NiklasEi/wasm-opt-action@v2 | |
with: | |
file: ./crates/gbpplanner-rs/dist/*.wasm | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4.2.5 | |
with: | |
branch: gh-pages | |
single-commit: true | |
folder: ./crates/gbpplanner-rs/dist |