Update gadgetPlus.deployment.yaml #2
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: GadgetPlus | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Start | |
run: npm start | |
- name: Deploy to AWS EC2 using ssh | |
uses: appleboy/ssh-action@v0.1.4 | |
with: | |
host: ${{ secrets.EC2_PUBLIC_IP }} | |
username: ubuntu | |
key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | |
script: | | |
echo "Connected to AWS EC2 instance" | |
# cd ~/home/danielwetan/apps/node1 | |
git pull origin master | |
git status | |
npm install | |
pm2 start app.js |