Skip to content

Workflow file for this run

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
'