forked from tekdi/eg-website
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 4.06 KB
/
dev-build-deploy.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
name: Deploy to DEV
on:
push:
branches:
- feat-sonarcloud
jobs:
build:
name: Generate Build and Deploy to DEV
environment: DEV
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node Env
uses: actions/setup-node@v3
with:
node-version: 18.0.0
- name: Generate React Build
run: yarn install --legacy-peer-deps
- name: Install caniuse-lite
run: npm install caniuse-lite --legacy-peer-deps
- name: Update Browserslist DB
run: npx update-browserslist-db@latest --legacy-peer-deps
- name: Build common-lib
run: yarn workspace @shiksha/common-lib build
- name: Install dependencies again
run: yarn install --legacy-peer-deps
- name: Set CI environment variable to false
run: echo "CI=false" >> $GITHUB_ENV
- name: Build front-end
run: yarn build
env:
REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }}
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }}
REACT_APP_BANNER_MESSAGE: ${{ secrets.REACT_APP_BANNER_MESSAGE }}
REACT_APP_GA_MEASUREMENT_ID: ${{ vars.REACT_APP_GA_MEASUREMENT_ID }}
REACT_APP_SENTRY_DSN_URL: ${{ secrets.REACT_APP_SENTRY_DSN_URL }}
REACT_APP_SENTRY_ENV: ${{ secrets.REACT_APP_SENTRY_ENV }}
REACT_APP_SCHOLARSHIP_URL: ${{ secrets.REACT_APP_SCHOLARSHIP_URL }}
REACT_APP_SCHOLARSHIPS_BAP_ID: ${{ secrets.REACT_APP_SCHOLARSHIPS_BAP_ID }}
REACT_APP_SCHOLARSHIPS_BAP_URI: ${{ secrets.REACT_APP_SCHOLARSHIPS_BAP_URI }}
REACT_APP_SCHOLARSHIPS_BASE_URL: ${{ secrets.REACT_APP_SCHOLARSHIPS_BASE_URL }}
REACT_APP_SCHOLARSHIP_DOMAIN: ${{ secrets.REACT_APP_SCHOLARSHIP_DOMAIN }}
REACT_APP_SCHOLARSHIPS_INSERT_ORDER: ${{ secrets.REACT_APP_SCHOLARSHIPS_INSERT_ORDER }}
REACT_APP_SCHOLARSHIP_DB_CACHE: ${{ secrets.REACT_APP_SCHOLARSHIP_DB_CACHE }}
REACT_APP_JOBS_BAP_ID: ${{ secrets.REACT_APP_JOBS_BAP_ID }}
REACT_APP_JOBS_BAP_URI: ${{ secrets.REACT_APP_JOBS_BAP_URI }}
REACT_APP_JOBS_BASE_URL: ${{ secrets.REACT_APP_JOBS_BASE_URL }}
REACT_APP_JOBS_DOMAIN: ${{ secrets.REACT_APP_JOBS_DOMAIN }}
REACT_APP_JOBS_INSERT_ORDER: ${{ secrets.REACT_APP_JOBS_INSERT_ORDER }}
REACT_APP_JOBS_DB_CACHE: ${{ secrets.REACT_APP_JOBS_DB_CACHE }}
REACT_APP_LEARNINGS_BAP_ID: ${{ secrets.REACT_APP_LEARNINGS_BAP_ID }}
REACT_APP_LEARNINGS_BAP_URI: ${{ secrets.REACT_APP_LEARNINGS_BAP_URI }}
REACT_APP_LEARNINGS_BASE_URL: ${{ secrets.REACT_APP_LEARNINGS_BASE_URL }}
REACT_APP_LEARNINGS_DB_CACHE: ${{ secrets.REACT_APP_LEARNINGS_DB_CACHE }}
REACT_APP_LEARNINGS_DOMAIN: ${{ secrets.REACT_APP_LEARNINGS_DOMAIN }}
- name: Create Lerna Bundles for Submodules
run: |
sh ./scripts/pack-prod-build.sh
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Add Entry to Known Hosts
run: ssh-keyscan -p ${{ secrets.SSH_PORT}} -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Copy Build Artifact using Rsync
run: rsync -avz -e "ssh -p ${{ secrets.SSH_PORT }}" eg-website.tar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/ubuntu/eg-website.tar
- name: Unzip Artifact to Correct Locations to Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /var/www/html/
rm -rf *
# rm -rf .
cd /home/ubuntu
tar -xvf eg-website.tar -C /var/www/html/
- name: Notify on Slack channel
uses: iRoachie/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
if: ${{ always() }}