-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 2.08 KB
/
deploy-react.yml
File metadata and controls
56 lines (48 loc) · 2.08 KB
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
on:
push:
branches:
- main
workflow_dispatch:
name: Deploy React
jobs:
deploy:
name: Deploy React
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: 'true'
token: ${{ secrets.WORKFLOW_SUBMODULE_PERSONAL_ACCESS_TOKEN }}
- name: Enable Corepack
run: corepack enable
- name: install node
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
- name: yarn install
run: yarn install
- name: Authenticate on GCS
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_MFLASH_PROD_JSON_KEY }}
- name: Make envfile
run: |
cd apps/react
touch .env
echo VITE_API_BASE_URL=https://mflash-api.riker.tech >> .env
echo VITE_DEPLOY_DATE=$(TZ=America/Los_Angeles date +"%Y-%m-%d %T") >> .env
echo VITE_DEPLOY_COMMIT=$(git rev-parse --short HEAD) >> .env
- name: Build & deploy
run: |
# Note: when a new environment is added, use the following command to set the automatic redirects:
# gsutil web set -m index.html -e index.html gs://NEW_ENV_SUBDOMAIN.riker.tech
echo "$(git log -10 --format=oneline)"
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
bucketname=mflash.riker.tech
yarn install
cd apps/react
yarn build
cd dist
gsutil cp -r ./ gs://$bucketname/
gsutil setmeta -h "Cache-Control:no-cache" gs://$bucketname/index.html