forked from icssc/AntAlmanac
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (109 loc) · 4.4 KB
/
deploy_production.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
---
name: Deploy CloudFormation stacks for production and development mirror
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
deployments: write
env:
# Tooling settings.
HUSKY: 0
NODE_ENV: production
# Application information.
MONGODB_URI_PROD: ${{ secrets.MONGODB_URI_PROD }}
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
VITE_TILES_ENDPOINT: ${{ secrets.VITE_TILES_ENDPOINT}}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
# Turborepo credentials.
TURBO_API: ${{ vars.TURBO_API }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: team_antalmanac
# AWS credentials.
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
# Information used by AWS CDK stacks.
HOSTED_ZONE_ID: ${{ secrets.HOSTED_ZONE_ID }}
CERTIFICATE_ARN: ${{ secrets.CERTIFICATE_ARN }}
PR_NUM: ${{ github.event.pull_request.number }}
jobs:
# Build production version of the frontend and upload the artifacts.
build_production_frontend:
name: Build production frontend and upload artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --prod false
- name: Build frontend
run: pnpm --filter "antalmanac" build
- name: Upload built artifacts
uses: actions/upload-pages-artifact@v2
with:
path: apps/antalmanac/build
# Deploy the built website to GitHub Pages.
deploy_production_frontend:
name: Deploy built frontend to GitHub Pages
needs: build_production_frontend
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: frontend-production
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# Production backend used by the live production website.
deploy_production_backend:
name: Deploy production backend CloudFormation stack and environment
runs-on: ubuntu-latest
environment:
name: backend-production
url: https://api.antalmanac.com
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --prod false
- name: Build backend
run: pnpm --filter "antalmanac-backend" build
- name: Deploy backend production CloudFormation stack
run: pnpm --filter "antalmanac-cdk" backend-production deploy
# A shadow/mirror of the production backend used as the default API endpoint during development and staging.
deploy_development_backend:
name: Deploy development backend CloudFormation stack and environment
runs-on: ubuntu-latest
environment:
name: backend-development
url: https://dev.api.antalmanac.com
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js and pnpm
uses: ./.github/actions/setup-node-and-pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --prod false
- name: Build backend
run: pnpm --filter "antalmanac-backend" build
env:
NODE_ENV: development
- name: Deploy backend development CloudFormation stack
run: pnpm --filter "antalmanac-cdk" backend-development deploy
env:
NODE_ENV: development