-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (118 loc) · 3.88 KB
/
build-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
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
name: Prod build
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: FONTAWESOME_PACKAGE_TOKEN="${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}" npm install
- name: Build
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY_PROD }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY_PROD }}
STRIPE_API_KEY: ${{ secrets.STRIPE_LIVE_KEY }}
RECAPTCHA_API_KEY: ${{ secrets.RECAPTCHA_API_KEY }}
FUSIONAUTH_HOST: ${{ secrets.FUSIONAUTH_PROD_HOST }}
STELA_DOMAIN: ${{ secrets.STELA_DOMAIN_PROD }}
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN_PROD }}
run: npm run build
- name: Archive `dist`
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
build-storybook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: FONTAWESOME_PACKAGE_TOKEN="${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}" npm install
- name: Build Storybook
run: npm run build-storybook
env:
GOOGLE_API_KEY: "-"
FIREBASE_API_KEY: "-"
STRIPE_API_KEY: "-"
- name: Archive `storybook-static`
uses: actions/upload-artifact@v4
with:
name: storybook
path: storybook-static
upload-sourcemaps:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
token: ${{ secrets.SENTRY_TOKEN }}
organization: permanentorg
project: mdot
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Upload sourcemaps
shell: bash
run: |
cp -r dist/mdot dist/app
cp -r dist/mdot dist/share
cp -r dist/mdot dist/p
declare -x VERSION=mdot@$(sentry-cli releases propose-version)
sentry-cli releases set-commits $VERSION --auto --ignore-missing
sentry-cli releases files $VERSION upload-sourcemaps --validate --log-level info --strip-common-prefix ./dist/ --ignore mdot
upload-code:
needs: [build, build-storybook]
runs-on: ubuntu-latest
steps:
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Download storybook
uses: actions/download-artifact@v4
with:
name: storybook
path: storybook
- name: Create a tar archive
run: |
cd ..
mkdir mdot
mv web-app/dist mdot/dist
mv web-app/storybook mdot/storybook
tar -czvf mdot.tar.gz mdot
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Copy package to S3
run: aws s3 cp ../mdot.tar.gz s3://permanent-repos/prod/mdot.tar.gz