Skip to content

chore(fern-bot): reset upgrade branch to default branch before upgrade #62

chore(fern-bot): reset upgrade branch to default branch before upgrade

chore(fern-bot): reset upgrade branch to default branch before upgrade #62

name: Preview @fern-ui/docs-bundle
env:
VERCEL_ORG_ID: team_6FKOM5nw037hv8g2mTk3gaH7
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name || github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: Preview - app.buildwithfern.com
url: ${{ steps.deploy.outputs.deployment_url }}
outputs:
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Build & Deploy to Vercel
uses: ./.github/actions/vercel
id: deploy
env:
ANALYZE: 1
VERCEL_PROJECT_ID: prj_QX3venU6jwRUmdt8ArfL8AU5r1d4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref_name || github.ref }}
token: ${{ secrets.VERCEL_TOKEN }}
package: "@fern-ui/docs-bundle"
environment: preview
force: ${{ github.event_name == 'workflow_dispatch' }}
- name: Analyze bundle
if: steps.deploy.outputs.deployment_url
run: pnpm --package=nextjs-bundle-analysis dlx report
- name: Upload analysis
if: steps.deploy.outputs.deployment_url
uses: actions/upload-artifact@v4
with:
name: analyze
path: packages/ui/docs-bundle/.next/analyze/
- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
if: steps.deploy.outputs.deployment_url && success() && github.event.number
with:
workflow: nextjs_bundle_analysis.yml
branch: ${{ github.event.pull_request.base.ref }}
path: packages/ui/docs-bundle/.next/analyze/base
# https://infrequently.org/2021/03/the-performance-inequality-gap/
- name: Compare with base branch bundle
if: steps.deploy.outputs.deployment_url && success() && github.event.number
run: ls -laR packages/ui/docs-bundle/.next/analyze/base && pnpm --package=nextjs-bundle-analysis dlx compare
- name: Comment PR Bundle Analysis
if: steps.deploy.outputs.deployment_url && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
filePath: packages/ui/docs-bundle/.next/analyze/__bundle_analysis_comment.txt
comment_tag: bundle_analysis
deploy-dev:
runs-on: ubuntu-latest
environment:
name: Preview - app-dev.buildwithfern.com
url: ${{ steps.deploy.outputs.deployment_url }}
outputs:
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
steps:
- uses: actions/checkout@v4
- name: Build & Deploy to Vercel
uses: ./.github/actions/vercel
id: deploy
env:
VERCEL_PROJECT_ID: prj_QnsiTm1ijJP6cS23K5da6lL02wbp
with:
ref: ${{ github.event.pull_request.head.ref || github.ref_name || github.ref }}
token: ${{ secrets.VERCEL_TOKEN }}
package: "@fern-ui/docs-bundle"
environment: preview
ete:
needs: deploy # only runs on fern-prod
if: needs.deploy.outputs.deployment_url
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
# this script generates domains.txt and preview.txt
- name: Generate preview URLs
env:
DEPLOYMENT_URL: ${{ needs.deploy.outputs.deployment_url }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
PR_PREVIEW: ${{ github.event_name == 'pull_request' }}
run: node scripts/fetch-domains.js
- name: Comment PR Preview
uses: thollander/actions-comment-pull-request@v2
if: github.event_name == 'pull_request'
with:
filePath: preview.txt
comment_tag: pr_preview
- name: Run E2E tests
uses: ./.github/actions/ete-docs-bundle
with:
deployment_url: ${{ needs.deploy.outputs.deployment_url }}