forked from CodeYourFuture/Full-Stack-Project-Assessment
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 914 Bytes
/
backEnd.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
name: Deploying to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository//download the source code repository
uses: actions/checkout@v3
- name: Create private key file and change permissions to read-only
run: |
echo "${{ secrets.AWS_PEM}}" > myPlayList-key-pair.pem
chmod 400 myPlayList-key-pair.pem
- name: Install dependencies and build
run:
ssh -i myPlayList-key-pair.pem -o StrictHostKeyChecking=no ${{vars.AWS_HOST_NAME}}@${{vars.AWS_HOST}} '
echo "env BEFORE" &&
env &&
export PATH="$PATH:/home/ubuntu/.nvm/versions/node/v20.11.1/bin" &&
echo "env AFTER" &&
env &&
cd Full-Stack-Project-Assessment/server &&
git pull &&
node -v &&
npm -v &&
pm2 -v
'