Initial commit #1
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 Web App | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "Cargo.web.toml" | |
- "Dioxus.pages.toml" | |
- "package.json" | |
- "src/**" | |
- "common/**" | |
- "assets/**" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
- name: Cache Rust dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install Bun dependencies | |
run: bun install --frozen-lockfile | |
- name: Generate TailwindCSS | |
run: bun build:tailwind | |
- name: Install Dioxus CLI | |
run: cargo install dioxus-cli | |
- name: Create .cargo/config.toml file | |
run: mkdir .cargo && printf "[profile.release]\nopt-level = \"z\"\ndebug = false\nlto = true\ncodegen-units = 1\npanic = \"abort\"\nstrip = true\nincremental = false\n" > .cargo/config.toml | |
- name: Create .env file | |
env: | |
API_URL: ${{ secrets.API_URL }} | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }} | |
SUPABASE_JWT_SECRET: ${{ secrets.SUPABASE_JWT_SECRET }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env | |
- name: Build | |
run: mv Cargo.toml Cargo.toml.bak && cp Cargo.web.toml Cargo.toml && cp Dioxus.pages.toml Dioxus.toml && dx build --release --platform web && cp ./dist/index.html ./dist/404.html | |
- name: Deploy to Github Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: ./dist | |
clean: false |