Update gadgetPlus.deployment.yaml #3
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 | |
with: | |
# Use Node.js 20 for the checkout action | |
node-version: '20' | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Log current directory | |
run: pwd | |
- name: List files in current directory | |
run: ls -la | |
- 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 |