generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (69 loc) · 2.58 KB
/
build.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
name: Build for Testing and Production
on:
workflow_dispatch: {}
push:
branches:
- master
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend-service
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('frontend-service/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --production=false
- name: Build frontend for testing
run: |
export REACT_APP_QUESTIONS_SERVICE_HOST=http://peerpreptest.bryanlohxz.com/api/questions-service
export REACT_APP_USERS_SERVICE_HOST=http://peerpreptest.bryanlohxz.com/api/users-service
export REACT_APP_MATCHMAKING_SERVICE_HOST=http://peerpreptest.bryanlohxz.com
export REACT_APP_COLLABORATION_SERVICE_HOST=http://peerpreptest.bryanlohxz.com
export CI=false
yarn build
- name: Set up Git
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
working-directory: .
- name: Add and commit changes
run: |
git add -f frontend-service/build/
git commit -m "Add changes"
working-directory: .
- name: Deploy to testing
run: |
git push -f origin HEAD:testing
working-directory: .
- name: Build frontend for production
run: |
export REACT_APP_QUESTIONS_SERVICE_HOST=https://peerprep.bryanlohxz.com/api/questions-service
export REACT_APP_USERS_SERVICE_HOST=https://peerprep.bryanlohxz.com/api/users-service
export REACT_APP_MATCHMAKING_SERVICE_HOST=https://peerprep.bryanlohxz.com
export REACT_APP_COLLABORATION_SERVICE_HOST=https://peerprep.bryanlohxz.com
export CI=false
yarn build
- name: Add and commit changes
run: |
git add -f frontend-service/build/
git commit -m "Add changes"
working-directory: .
- name: Deploy to production
run: |
git push -f origin HEAD:production
working-directory: .