name: "Deploy new pages build"

on:
  workflow_dispatch:
    inputs:
      enable_dev_mode:
        description: Enable dev mode (enable dev menu, disable minification, etc.)
        type: boolean
        required: false
        default: false

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npm ci
      - env:
          ENABLE_DEV_MODE: ${{ github.event.inputs.enable_dev_mode }}
        run: |
          if [[ "$ENABLE_DEV_MODE" == 'true' ]]; then
            npm run build:dev
          else
            npm run build
          fi
      - uses: actions/upload-pages-artifact@v3
        with:
          path: ".app"
      - name: Deploy to gh pages
        id: deployment
        uses: actions/deploy-pages@v4
