adjust Nepal CI #4
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: Deploy NEPAL | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Deploy to nepal server | |
runs-on: ubuntu-latest | |
env: | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_DATABASE: ${{ secrets.DB_DATABASE_NP }} | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v1 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: npm install | |
- name: Run Migrations | |
run: npm run build | |
- name: Run Migrations | |
run: npm run migration:run | |
- name: Copy public folder | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
source: "src,node_modules,build,package.json,Dockerfile,docker-compose-np.yml" | |
target: "/home/ubuntu/apps/coach-backend-np" | |
- name: executing remote ssh commands using ssh key | |
uses: appleboy/ssh-action@v0.1.8 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
script: | | |
cd /home/ubuntu/apps/coach-backend-np | |
sudo docker build -t coach-backend-np . | |
sudo docker-compose -f docker-compose-np.yml up -d |