Fix: Implement a tailwinds config file for release. #38
This file contains hidden or 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: pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: compiler | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Install wasm target | |
| run: rustup target add wasm32-unknown-unknown | |
| working-directory: compiler | |
| - name: Install wasm-opt | |
| run: | | |
| curl -sSL https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz \ | |
| | tar -xz --strip-components=2 -C /usr/local/bin binaryen-version_121/bin/wasm-opt | |
| wasm-opt --version | |
| - name: Build wasm | |
| run: cargo build --target wasm32-unknown-unknown --features wasm --lib --release | |
| working-directory: compiler | |
| - name: Size (unoptimized) | |
| run: ls -lh target/wasm32-unknown-unknown/release/compiler_lib.wasm | |
| working-directory: compiler | |
| - name: Optimize wasm | |
| run: | | |
| INPUT=compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm | |
| wasm-opt -Oz --converge \ | |
| --generate-global-effects \ | |
| --strip-debug --strip-producers \ | |
| --enable-bulk-memory-opt \ | |
| --enable-nontrapping-float-to-int \ | |
| --enable-sign-ext \ | |
| -tnh \ | |
| -o /tmp/wasm_stage1.wasm "$INPUT" | |
| wasm-opt --flatten --rereloop -Oz -Oz \ | |
| --enable-bulk-memory-opt \ | |
| --enable-nontrapping-float-to-int \ | |
| --enable-sign-ext \ | |
| -o "$INPUT" /tmp/wasm_stage1.wasm | |
| rm /tmp/wasm_stage1.wasm | |
| - name: Write version manifest | |
| run: | | |
| HASH=$(sha256sum compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm \ | |
| | cut -c1-12) | |
| printf '{"v":"%s"}\n' "$HASH" > demo/version.json | |
| - name: Size (optimized) | |
| run: ls -lh target/wasm32-unknown-unknown/release/compiler_lib.wasm | |
| working-directory: compiler | |
| - name: Build Tailwind CSS | |
| run: echo "@tailwind base;@tailwind components;@tailwind utilities;" | npx tailwindcss@3 --input - --output demo/tailwind.css --minify | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| with: | |
| enablement: true | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: demo | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |