Skip to content

feat: change labels from howtos to projects #231

feat: change labels from howtos to projects

feat: change labels from howtos to projects #231

name: Deploy Fly PR Preview
on:
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
pull_request_target:
# Trigger when labels are changed or more commits added to a PR that contains labels
types: [labeled, synchronize]
# Only create a preview if changes have been made to the main src code or backend functions
paths:
- 'src/**'
- 'functions/**'
- 'packages/components/**'
- '.github/workflows/pr-preview.yml'
- 'package.json'
- 'yarn.lock'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
# Set these to your Fly.io organization and preferred region.
FLY_REGION: ams
FLY_ORG: one-army
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.PREVIEW_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.PREVIEW_PROJECT_ID }}
SUPABASE_API_URL: ${{ secrets.SUPABASE_API_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_PRIVATE_KEY: ${{ secrets.FIREBASE_PRIVATE_KEY }}
FIREBASE_CLIENT_EMAIL: ${{ secrets.FIREBASE_CLIENT_EMAIL }}
FLY_APP_NAME: community-platform-pr-${{ github.event.number }}
jobs:
preview_app:
if: contains(github.event.pull_request.labels.*.name, 'Review allow-preview ✅')
runs-on: ubuntu-latest
continue-on-error: true
outputs:
url: ${{ steps.deploy.outputs.url }}
# Only run one deployment at a time per PR.
concurrency:
group: pr-${{ github.event.number }}
# Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI.
# Feel free to change the name of this environment.
environment:
name: preview
# The script in the `deploy` sets the URL output for each review app.
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Get code
uses: actions/checkout@v4
with:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}
- name: Install supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest
- name: Link Supabase project
run: supabase link --project-ref $SUPABASE_PROJECT_ID
- name: Push Supabase DB
run: supabase db push
- name: Install Fly CLI
run: |
curl -L https://fly.io/install.sh | sh
echo "$HOME/.fly/bin" >> "$GITHUB_PATH"
- name: Deploy PR app to Fly.io
id: deploy
uses: superfly/fly-pr-review-apps@1.3.0
with:
config: fly-preview.toml
name: community-platform-pr-${{ github.event.number }}
- name: Set Fly.io Secrets
run: |
fly -a $FLY_APP_NAME secrets set SUPABASE_API_URL=$SUPABASE_API_URL SUPABASE_KEY=$SUPABASE_KEY FIREBASE_PROJECT_ID=$FIREBASE_PROJECT_ID FIREBASE_PRIVATE_KEY="$FIREBASE_PRIVATE_KEY" FIREBASE_CLIENT_EMAIL=$FIREBASE_CLIENT_EMAIL