This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} ' | |
export PATH="$PATH:/home/ubuntu/.nvm/versions/node/v20.11.1/bin" && | |
cd Full-Stack-Project-Assessment/server && | |
git pull && | |
pm2 start server.js | |
' |