Update README.md #37
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: Push-to-EC2 | |
# Trigger deployment only on push to master branch | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Deploy to EC2 on master branch push | |
runs-on: ubuntu-latest | |
## Checkout the files | |
steps: | |
- name: Checkout the files | |
uses: actions/checkout@v2 | |
## Install Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
## Install dependencies for frontend and backend | |
- name: Install dependencies | |
run: cd frontend && npm install && cd .. && cd backend && npm install && cd .. | |
## Build the frontend | |
- name: Build | |
run: cd frontend && npm run build && sudo rm -rf node_modules && cd .. | |
env: | |
CI: false | |
## Deploy to EC2 | |
- name: Deploy to Server 1 | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: ${{ secrets.TARGET }} |