Something went wrong. Try again.
Local-first knowledge base made for Typst and the Atmosphere. typbase.at
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293name: Deploy Cloudflare
on: push: branches: - main workflow_dispatch:
concurrency: group: deploy-cloudflare-${{ github.ref }} cancel-in-progress: true
env: NUXT_PUBLIC_APP_URL: ${{ vars.CLOUDFLARE_APP_URL || format('https://typbase.{0}.workers.dev', github.repository_owner) }} NUXT_PUBLIC_NATIVE_APP_URL: https://typbase.at
jobs: deploy: name: ☁️ Deploy runs-on: ubuntu-latest permissions: contents: read steps: - name: 🔍 Check configuration id: gate shell: bash env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || vars.CLOUDFLARE_ACCOUNT_ID }} run: | if [[ -n "$CLOUDFLARE_API_TOKEN" && -n "$CLOUDFLARE_ACCOUNT_ID" ]]; then echo "deploy=true" >> "$GITHUB_OUTPUT" else echo "Cloudflare credentials are not set; skipping the deploy." echo "deploy=false" >> "$GITHUB_OUTPUT" fi
- name: 🔄 Checkout if: steps.gate.outputs.deploy == 'true' uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 1
- name: 🦀 Setup Rust if: steps.gate.outputs.deploy == 'true' uses: moonrepo/setup-rust@abb2d32350334249b178c401e5ec5836e0cd88d3 # v1.3.0 with: bins: wasm-pack@0.15.1 targets: wasm32-unknown-unknown
- name: 🌙 Setup moon if: steps.gate.outputs.deploy == 'true' uses: ./.github/actions/setup-moon with: node-version: "26"
- name: 📥 Install dependencies if: steps.gate.outputs.deploy == 'true' run: pnpm install --frozen-lockfile
- name: 🔨 Generate the static site if: steps.gate.outputs.deploy == 'true' run: pnpm generate
- name: 🛡️ Check the OAuth metadata if: steps.gate.outputs.deploy == 'true' env: APP_URL: ${{ env.NUXT_PUBLIC_APP_URL }} NATIVE_APP_URL: ${{ env.NUXT_PUBLIC_NATIVE_APP_URL }} run: bash scripts/ci/check-oauth-metadata.sh
- name: 📏 Check the wasm size if: steps.gate.outputs.deploy == 'true' run: node scripts/ci/check-wasm-size.mjs apps/web/.output/public
- name: 🧰 Prepare the Wrangler action if: steps.gate.outputs.deploy == 'true' shell: bash run: | mkdir -p "$RUNNER_TEMP/wrangler-action" printf '{"private":true}\n' > "$RUNNER_TEMP/wrangler-action/package.json"
- name: 🚀 Deploy to Cloudflare Workers if: steps.gate.outputs.deploy == 'true' uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || vars.CLOUDFLARE_ACCOUNT_ID }} workingDirectory: ${{ runner.temp }}/wrangler-action packageManager: npm wranglerVersion: "4" command: deploy --config ${{ github.workspace }}/apps/web/wrangler.jsonc