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: Build and Deployment | |
on: [push] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: | | |
echo "@iam-hussain:registry=https://npm.pkg.github.com" >> .npmrc | |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.TOKEN }}" >> .npmrc | |
- run: npm ci | |
- run: npm run prisma:generate | |
- run: npm run build | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.TOKEN }} | |
deployment: | |
name: Deployment | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Connect SSH and Run Scripts | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
script: | | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
cd /root/projects/qd-service | |
nvm use | |
git checkout . | |
git pull | |
npm ci | |
npm run prisma:setup | |
npm run build | |
pm2 restart qd-service |