-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (66 loc) · 2.09 KB
/
deploy_client_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
name: Deploy Client Production
on:
push:
branches: [main]
jobs:
deploy_production:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Create Env File
run: |
touch .env
echo "${{ secrets.PROD_ENV }}" >> .env
- name: Cache node_modules
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm i --force
- name: Build
run: CI= npm run build
- name: Compress
run: tar -zcvf ${GITHUB_SHA::8}.tar.gz build
- name: Upload to S3
run: |
aws s3 mv --region ap-northeast-2 \
${GITHUB_SHA::8}.tar.gz \
${{ secrets.S3_PROD_FRONT_LOCATION }}/${GITHUB_SHA::8}.tar.gz
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_PROD }}
username: ${{ secrets.USERNAME_PROD }}
port: ${{ secrets.PORT_PROD }}
key: ${{ secrets.KEY_PROD }}
envs: GITHUB_SHA
script: |
cd ~/keeper/deploy
./deploy_client.sh ${GITHUB_SHA::8}
- name: Notify Slack
if: always()
uses: 8398a7/action-slack@v3
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
author_name: Keeper Production Frontend CICD
fields: repo, commit, message, author, job, took