-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (84 loc) · 3.27 KB
/
deploy-fdr-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Deploy FDR
on:
push:
tags: ["*"]
env:
PACKAGE_NAME: "@fern-platform/fdr"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FERNIE_SLACK_APP_TOKEN: ${{ secrets.FERNIE_SLACK_APP_TOKEN }}
GITHUB_TOKEN: ${{ secrets.FERN_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
jobs:
sdk:
if: github.ref_type == 'tag' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/fdr@')
uses: ./.github/workflows/publish-fdr-sdk.yml
secrets: inherit
deploy_prod:
strategy:
matrix:
concurrency: [1]
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/fdr@')
environment: Fern Prod
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}/fdr?schema=public&connection_limit=6&pool_timeout=30
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
ALGOLIA_SEARCH_INDEX: ${{ secrets.ALGOLIA_SEARCH_INDEX }}
ALGOLIA_SEARCH_V2_DOMAINS: "workato,rohin-bhargava-staging,monite,humanloop,cohere,buildwithfern.com/learn"
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
APPLICATION_ENVIRONMENT: prod
steps:
- uses: actions/checkout@v4
- name: 📥 Install
uses: ./.github/actions/install
- name: 🧪 Build and test
run: pnpm turbo build test --filter=${{ env.PACKAGE_NAME }}
- name: 💻 Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# Currently we migrate in the Docker container
# - name: 🔄 DB Migration
# run: pnpm run --filter=@fern-platform/fdr db:migrate:prod
# env:
# DATABASE_URL: ${{ secrets.DATABASE_URL }}/fdr?schema=public
- name: 🚀 cdk deploy
run: |
git_version="$(scripts/git-version.sh)"
pnpm run --filter=@fern-platform/fdr docker:prod "${git_version}"
npm install -g aws-cdk
cd servers/fdr-deploy
VERSION="${git_version}" pnpm --filter=@fern-platform/fdr-deploy deploy:prod
smoke-test:
needs: deploy_prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Smoke Test Dev Docs
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_prod
uses: ./.github/workflows/healthcheck.yml
secrets: inherit