Skip to content

fix: turn off isr for redirects (#1468) #509

fix: turn off isr for redirects (#1468)

fix: turn off isr for redirects (#1468) #509

Workflow file for this run

name: Vercel Production Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_INDEX: ${{ secrets.ALGOLIA_SEARCH_INDEX }}
NEXT_PUBLIC_POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
FONTAWESOME_CDN_HOST: https://icons.ferndocs.com
WORKOS_API_KEY: ${{ secrets.WORKOS_API_KEY }}
WORKOS_CLIENT_ID: ${{ secrets.WORKOS_CLIENT_ID }}
JWT_SECRET_KEY: ${{ secrets.PROD_JWT_SECRET_KEY }}
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
TURBO_TEAM: "buildwithfern"
SEGMENT_API_KEY: ${{ secrets.SEGMENT_API_KEY }}
on:
push:
tags:
- "**"
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ui@')
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.4.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: VERSION="$(scripts/git-version.sh)" vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: |
DEPLOYMENT_URL="$(vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }})"
echo "Deployment URL: $DEPLOYMENT_URL"
echo "Starting revalidation..."
DEPLOYMENT_URL=$(echo $DEPLOYMENT_URL | awk -F'/' '{print $3}')
DEPLOYMENT_INFO=$(curl -s -X GET "https://api.vercel.com/v13/deployments/$DEPLOYMENT_URL?teamId=team_6FKOM5nw037hv8g2mTk3gaH7&withGitRepoInfo=false" -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}")
ALIAS_DOMAINS=$(jq -r '.alias[]' <<< $DEPLOYMENT_INFO)
echo "## PR Preview" > preview.txt
for DOMAIN in ${ALIAS_DOMAINS[@]}; do
if [[ "$DOMAIN" != *"buildwithfern.com"* ]] && [[ "$DOMAIN" != *"vercel.app"* ]]; then
if curl -s -X POST "https://$DOMAIN/api/revalidate-all" -H "x-fern-host: $DOMAIN"; then
echo "Revalidated: $DOMAIN"
else
echo "Failed to revalidate $DOMAIN, but continuing with other domains"
fi
fi
done
curl -s -X POST https://docs.buildwithfern.com/api/revalidate-all -H "x-fern-host: docs.buildwithfern.com"
echo "Revalidated: docs.buildwithfern.com"
echo "Done!"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: preview
path: preview.txt
smoke-test:
needs: deploy
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: deploy
uses: ./.github/workflows/healthcheck.yml
secrets: inherit