Skip to content

fix(epics): profile menu dismissal (#1790) + requirements spec #4529

fix(epics): profile menu dismissal (#1790) + requirements spec

fix(epics): profile menu dismissal (#1790) + requirements spec #4529

Workflow file for this run

name: Deploy Preview
on:
pull_request:
concurrency:
group: deploy-preview-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
NEON_DATABASE_USERNAME: ${{ secrets.DB_USER_NAME }} # change this to your database username
NEON_DATABASE_NAME: ${{ secrets.DB_NAME }} # change this to your database name
NEON_API_KEY: ${{ secrets.NEON_API_KEY }} # You can generate a an API key in your account settings
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }} # You can find this in your project settings
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
DEFAULT_DB_URL: ${{ secrets.POSTGRES_URL }}
PRIVATE_KEY: ${{ secrets.EVM_SC_OWNER_PRIVATE_KEY }}
DEFAULT_DB_AUTHENTICATED_URL: ${{ secrets.POSTGRES_AUTHENTICATED_URL }}
DEFAULT_DB_ANONYMOUS_URL: ${{secrets.POSTGRES_ANONYMOUS_URL}}
jobs:
detect-changes:
runs-on: blacksmith-4vcpu-ubuntu-2404
outputs:
has_migrations: ${{ steps.detect.outputs.has_migrations }}
has_preview_deploy_changes: ${{ steps.detect.outputs.has_preview_deploy_changes }}
steps:
- uses: actions/checkout@v4
- name: Detect Changes
id: detect
uses: ./.github/actions/detect-changes
deploy-preview:
needs: detect-changes
if: needs.detect-changes.outputs.has_preview_deploy_changes == 'true'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Get branch name
if: needs.detect-changes.outputs.has_migrations == 'true'
id: branch-name
uses: tj-actions/branch-names@v8
- name: Create Neon Branch
if: needs.detect-changes.outputs.has_migrations == 'true'
id: create-branch
uses: neondatabase/create-branch-action@v5
with:
project_id: ${{ env.NEON_PROJECT_ID }}
parent: main
branch_name: preview/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }}
username: ${{ env.NEON_DATABASE_USERNAME }}
database: ${{ env.NEON_DATABASE_NAME }}
api_key: ${{ env.NEON_API_KEY }}
- name: Update branch variables
if: needs.detect-changes.outputs.has_migrations == 'true'
run: |
echo "BRANCH_DB_URL=${{ steps.create-branch.outputs.db_url_with_pooler }}" >> $GITHUB_ENV
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ env.VERCEL_TOKEN }}
- name: Run Migrations
if: needs.detect-changes.outputs.has_migrations == 'true'
env:
BRANCH_DB_URL: ${{ steps.create-branch.outputs.db_url_with_pooler }}
run: |
vercel env pull --environment=preview --token=${{ env.VERCEL_TOKEN }}
pnpm run migrate
- name: Post Schema Diff Comment to PR
if: needs.detect-changes.outputs.has_migrations == 'true'
uses: neondatabase/schema-diff-action@v1
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
compare_branch: preview/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }}
api_key: ${{ secrets.NEON_API_KEY }}
- name: Build Project Artifacts
env:
BRANCH_DB_URL: ${{ steps.create-branch.outputs.db_url_with_pooler }}
run: |
vercel env pull --environment=preview --token=${{ env.VERCEL_TOKEN }}
vercel build --token=${{ env.VERCEL_TOKEN }}
- name: Deploy Preview to Vercel
id: deploy
env:
BRANCH_DB_URL: ${{ steps.create-branch.outputs.db_url_with_pooler }}
run: echo preview_url=$(vercel deploy --prebuilt --token=${{ env.VERCEL_TOKEN }} --env BRANCH_DB_URL=${{ env.BRANCH_DB_URL }}) >> $GITHUB_OUTPUT
main:
needs: [detect-changes]
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run format:check
- name: Get branch name
if: needs.detect-changes.outputs.has_migrations == 'true'
id: branch-name
uses: tj-actions/branch-names@v8
- name: Create Neon Branch
if: needs.detect-changes.outputs.has_migrations == 'true'
id: create-branch
uses: neondatabase/create-branch-action@v5
with:
project_id: ${{ env.NEON_PROJECT_ID }}
parent: main
branch_name: test/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }}
username: ${{ env.NEON_DATABASE_USERNAME }}
database: ${{ env.NEON_DATABASE_NAME }}
api_key: ${{ env.NEON_API_KEY }}
- name: Update branch variables
if: needs.detect-changes.outputs.has_migrations == 'true'
run: |
echo "BRANCH_DB_URL=${{ steps.create-branch.outputs.db_url_with_pooler }}" >> $GITHUB_ENV
- name: Run Migrations
if: needs.detect-changes.outputs.has_migrations == 'true'
run: |
echo "BRANCH_DB_URL: ${{ steps.create-branch.outputs.db_url_with_pooler }}" >> apps/web/.env.production
pnpm run migrate
- name: Delete Neon Branch
if: always() && needs.detect-changes.outputs.has_migrations == 'true'
uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch: test/pr-${{ github.event.number }}-${{ steps.branch-name.outputs.current_branch }}
api_key: ${{ secrets.NEON_API_KEY }}