name: Deploy Hotfix To Stage on: push: branches: - hotfix/* jobs: build: environment: prod runs-on: node 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: "Copy files over to location" run: cp -r . ${{ secrets.HOTFIX_REPO_PATH }} deploy: environment: prod needs: build runs-on: node steps: - uses: https://github.com/appleboy/ssh-action@v1.0.0 env: DB_NAME: ${{ secrets.HOTFIX_DB_NAME }} DB_AUTH_USER: ${{ secrets.HOTFIX_DB_AUTH_USER }} DB_AUTH_PASS: ${{ secrets.HOTFIX_DB_AUTH_PASS }} DB_HOST: ${{ secrets.HOTFIX_DB_HOST }} DB_PORT: ${{ secrets.HOTFIX_DB_PORT }} DB_ROOT_HOST: ${{ secrets.HOTFIX_DB_ROOT_HOST }} DB_SYNC: ${{ secrets.HOTFIX_DB_SYNC }} DB_LOGGING: ${{ secrets.HOTFIX_DB_LOGGING }} DB_DATA_LOCATION: ${{ secrets.HOTFIX_DB_DATA_LOCATION }} SERVER_PATH: ${{ secrets.HOTFIX_SSH_SERVER_PATH }} BOT_TOKEN: ${{ secrets.HOTFIX_BOT_TOKEN }} BOT_VER: ${{ vars.HOTFIX_BOT_VER }} BOT_AUTHOR: ${{ vars.HOTFIX_BOT_AUTHOR }} BOT_OWNERID: ${{ vars.HOTFIX_BOT_OWNERID }} BOT_CLIENTID: ${{ vars.HOTFIX_BOT_CLIENTID }} ABOUT_FUNDING: ${{ vars.HOTFIX_ABOUT_FUNDING }} ABOUT_REPO: ${{ vars.HOTFIX_ABOUT_REPO }} CACHE_INTERVAL: ${{ vars.HOTFIX_CACHE_INTERVAL }} with: host: ${{ secrets.HOTFIX_SSH_HOST }} username: ${{ secrets.HOTFIX_SSH_USER }} key: ${{ secrets.HOTFIX_SSH_KEY }} port: ${{ secrets.HOTFIX_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,CACHE_INTERVAL script: | source .sshrc \ && cd /home/vylpes/apps/vylbot/vylbot_hotfix \ && docker compose down \ && (pm2 stop vylbot_hotfix || true) \ && (pm2 delete vylbot_hotfix || true) \ && (pm2 stop vylbot_stage || true) \ && (pm2 delete vylbot_stage || true) \ && (pm2 stop vylbot_release || true) \ && (pm2 delete vylbot_release || true) \ && docker compose up -d \ && sleep 10 \ && yarn db:up \ && pm2 start --name vylbot_hotfix dist/vylbot.js