Skip to content

Install npm on cloudinit #2

Install npm on cloudinit

Install npm on cloudinit #2

Workflow file for this run

name: Deploy To Production
on:
push:
branches:
- main
jobs:
build:
environment: prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: RSync to Stage Server
uses: D3rHase/[email protected]
with:
HOST: ${{ secrets.SSH_HOST }}
PORT: ${{ secrets.SSH_PORT }}
USER: ${{ secrets.SSH_USER }}
PRIVATE_SSH_KEY: ${{ secrets.SSH_KEY }}
REPOSITORY_PATH: ${{ secrets.SSH_REPO_PATH }}
SERVER_PATH: ${{ secrets.SSH_SERVER_PATH }}
deploy:
environment: prod
needs: build
runs-on: ubuntu-latest
steps:
- uses: appleboy/[email protected]
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_AUTH_USER: ${{ secrets.DB_AUTH_USER }}
DB_AUTH_PASS: ${{ secrets.DB_AUTH_PASS }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_ROOT_HOST: ${{ secrets.DB_ROOT_HOST }}
DB_SYNC: ${{ secrets.DB_SYNC }}
DB_LOGGING: ${{ secrets.DB_LOGGING }}
DB_DATA_LOCATION: ${{ secrets.DB_DATA_LOCATION }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
BOT_VER: ${{ vars.BOT_VER }}
BOT_AUTHOR: ${{ vars.BOT_AUTHOR }}
BOT_OWNERID: ${{ vars.BOT_OWNERID }}
BOT_CLIENTID: ${{ vars.BOT_CLIENTID }}
ABOUT_FUNDING: ${{ vars.ABOUT_FUNDING }}
ABOUT_REPO: ${{ vars.ABOUT_FUNDING }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO
script: |
cd ~/app \
&& docker compose down \
&& (pm2 stop vylbot || true) \
&& (pm2 delete vylbot || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn run db:up \
&& pm2 start --name vylbot dist/vylbot.js