name: Deploy Benchmark Site to Preview Channel

on:
  pull_request:
    paths:
    - "e2e/benchmarks/**"

permissions:
  contents: read

jobs:
  build_and_preview:
    permissions:
      pull-requests: write # for FirebaseExtended/action-hosting-deploy to comment on PRs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSTENSORFLOW }}"
          expires: 30d
          projectId: jstensorflow
          target: tfjs-benchmarks
          entryPoint: e2e/benchmarks/
