1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Preview

on:
  pull_request:
    types: [opened, reopened, synchronize, closed]

permissions: {}

concurrency:
  group: ${{ github.workflow }}-${{ github.event.number }}
  cancel-in-progress: true

env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
  FLY_REGION: sjc
  FLY_ORG: personal

jobs:
  preview:
    name: Preview
    runs-on: ubuntu-latest
    permissions:
      contents: read # checkout
    environment:
      name: pr-${{ github.event.number }}
      url: ${{ steps.deploy.outputs.url }}
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          persist-credentials: false

      - uses: superfly/flyctl-actions/setup-flyctl@ed8efb33836e8b2096c7fd3ba1c8afe303ebbff1 # 1.6

      # Creates the app on open, redeploys it on each push, and destroys
      # it when the PR closes.
      - name: Deploy preview
        id: deploy
        uses: superfly/fly-pr-review-apps@f5d85309215d5700e7a42faf9aa5e9a718aaef7c # 1.5.0
        with:
          config: fly.toml
          memory: 256