name: Mobile candidate binaries
on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
    paths:
      - '.factory/releases/mobile.json'

permissions:
  contents: write
  actions: read
  models: read
  deployments: write

concurrency:
  group: mobile-candidate-${{ github.event.pull_request.number }}
  cancel-in-progress: true

jobs:
  binaries:
    if: >-
      ${{ github.event.pull_request.head.repo.full_name == github.repository
          && startsWith(github.event.pull_request.head.ref, 'task/')
          && !github.event.pull_request.draft
          && github.event.pull_request.base.ref == github.event.repository.default_branch }}
    uses: ./.github/workflows/deploy.yml
    with:
      candidate-build: true
    secrets: inherit
