Skip to content

feat: support raw markdown (#1820) #55

feat: support raw markdown (#1820)

feat: support raw markdown (#1820) #55

name: Deploy @fern-ui/docs-bundle
on:
push:
tags:
- ui@*
concurrency:
group: app.buildwithfern.com
cancel-in-progress: true
jobs:
deploy_app_buildwithfern_com:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push'
environment:
name: Production - app.buildwithfern.com
url: ${{ steps.deploy.outputs.deployment_url }}
outputs:
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- name: Build & Deploy to Vercel
id: deploy
run: |
pnpm vercel-scripts deploy app.buildwithfern.com --token=${{ secrets.VERCEL_TOKEN }} --environment=production
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
deploy_app_ferndocs_com:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push'
environment:
name: Production - app.ferndocs.com
url: ${{ steps.deploy.outputs.deployment_url }}
outputs:
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- name: Build & Deploy to Vercel
id: deploy
run: |
pnpm vercel-scripts deploy app.ferndocs.com --token=${{ secrets.VERCEL_TOKEN }} --environment=production
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
deploy_app-slash_ferndocs_com:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push'
environment:
name: Production - app-slash.ferndocs.com
url: ${{ steps.deploy.outputs.deployment_url }}
outputs:
deployment_url: ${{ steps.deploy.outputs.deployment_url }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- name: Build & Deploy to Vercel
id: deploy
run: |
pnpm vercel-scripts deploy app-slash.ferndocs.com --token=${{ secrets.VERCEL_TOKEN }} --environment=production
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
# note: E2E tests should run before the deployment is promoted
# but currently tests that rely on javascript are not running successfully b/c of assetPrefix issues
# so we we are running the tests after the deployment is promoted for now
# TODO: Fix the tests and run them before promoting the deployment
ete:
needs:
- deploy_app_buildwithfern_com # only the app.buildwithfern.com deployment is an E2E candidate but ideally all deployments should be tested
- promote
if: needs.deploy_app_buildwithfern_com.outputs.deployment_url
uses: ./.github/workflows/playwright.yml
permissions: write-all
with:
deployment_url: ${{ needs.deploy_app_buildwithfern_com.outputs.deployment_url || '' }}
secrets:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
revalidate-all:
needs: promote
if: success()
runs-on: ubuntu-latest
steps:
- name: Revalidate all app.buildwithfern.com deployments
run: pnpm vercel-scripts revalidate-all app.buildwithfern.com --token ${{ secrets.VERCEL_TOKEN }}
rollback:
needs: ete
if: failure()
runs-on: ubuntu-latest
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Rollback on failure # remove this step once we switch back to pre-promotion testing
run: |
echo "E2E tests failed. Rolling back deployment"
pnpm vercel-scripts rollback app.buildwithfern.com --token ${{ secrets.VERCEL_TOKEN }}
pnpm vercel-scripts rollback app.ferndocs.com --token ${{ secrets.VERCEL_TOKEN }}
pnpm vercel-scripts rollback app-slash.ferndocs.com --token ${{ secrets.VERCEL_TOKEN }}
# currently only the custom domains for app.buildwithfern.com deployment should be revalidated
# because the other deployments don't have custom domains (yet)
pnpm vercel-scripts revalidate-all app.buildwithfern.com --token ${{ secrets.VERCEL_TOKEN }}
echo "All docs deployments have been rolled back successfully!"
exit 1
promote:
needs:
- deploy_app_buildwithfern_com
- deploy_app_ferndocs_com
- deploy_app-slash_ferndocs_com
# - ete # Ensure that the E2E tests are run successful before promoting
runs-on: ubuntu-latest
strategy:
matrix:
deployment_url:
- ${{ needs.deploy_app_buildwithfern_com.outputs.deployment_url }}
- ${{ needs.deploy_app_ferndocs_com.outputs.deployment_url }}
- ${{ needs.deploy_app-slash_ferndocs_com.outputs.deployment_url }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install
- name: Promote Deployment
run: pnpm vercel-scripts promote ${{ matrix.deployment_url }} --token ${{ secrets.VERCEL_TOKEN }}
smoke-test:
needs: promote # Ensure that the deployment is promoted before running smoke tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Smoke Test
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
cd smoke-test
npm install -g fern-api
fern generate --docs --instance https://fern-platform-test.docs.buildwithfern.com
VALUE=$(curl https://fern-platform-test.docs.buildwithfern.com/api-reference/imdb/create-movie)
length=${#VALUE}
# Assert that length is over 1000
if [ $length -gt 1000 ]; then
echo "Length is greater than 1000"
else
exit 1
fi
healthchecks:
needs: promote # Ensure that the deployment is promoted before running healthchecks
uses: ./.github/workflows/healthcheck.yml
secrets: inherit