pipeline:
  build:
    image: node:20-alpine
    commands:
      - npm ci
      - npm run build
    when:
      branch: main
      event: [push, pull_request]
  deploy:
    depends_on: [build]
    image: flyio/flyctl:latest
    secrets: [fly_api_token]
    commands:
      - flyctl deploy --remote-only
    when:
      branch: main
      event: push

branches:
  include: [main, dev]

cache:
  mount:
    - node_modules
    - .npm