-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (42 loc) · 1.31 KB
/
deploy.yaml
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
name: Deploy to EC2
on:
push:
branches:
- main
jobs:
build:
name: Build service
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Install Node.JS
uses: actions/setup-node@v4
with:
node-version: 18.18.2
- name: Install yarn globally
run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Setting up dependency Cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Installing Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --immutable
- name: Build service
run: yarn build
- name: Deploy Changes
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
scp -r ./dist ${USER_NAME}@${HOSTNAME}:/home/ec2-user/auto-presence
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
ls
'