Skip to content

Merge pull request #42 from SheershBhatnagar/main #32

Merge pull request #42 from SheershBhatnagar/main

Merge pull request #42 from SheershBhatnagar/main #32

Workflow file for this run

name: Koders Portfolio App
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.14.0
- name: Install dependencies
run: npm install --production
- name: Build React app
run: npm run build
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Debug build directory contents
run: ls -R .
- name: Copy build to VPS via SSH
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
password: ${{ secrets.REMOTE_PASSWORD }}
source: "build/"
target: /root/portfolio/
- name: SSH into VPS and deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
password: ${{ secrets.REMOTE_PASSWORD }}
script: |
cd /root/portfolio
docker rm $(docker stop $(docker ps -a -q --filter ancestor=koders-website-v5 --format="{{.ID}}"))
docker rmi koders-website-v5
docker build . -t koders-website-v5
docker run -d -p 8081:3000 --name koders-website-v5 -e ${{ secrets.WEBHOOK_URL }} koders-website-v5