Add stage script
This commit is contained in:
parent
c33b4a8fdb
commit
cb1b098daa
3 changed files with 472 additions and 710 deletions
67
.forgejo/workflows/stage.yml
Normal file
67
.forgejo/workflows/stage.yml
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
name: Deploy To Stage
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
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: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm test
|
||||||
|
|
||||||
|
- name: "Copy files over to location"
|
||||||
|
run: cp -r . ${{ secrets.STAGE_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.STAGE_DB_NAME }}
|
||||||
|
DB_AUTH_USER: ${{ secrets.STAGE_DB_AUTH_USER }}
|
||||||
|
DB_AUTH_PASS: ${{ secrets.STAGE_DB_AUTH_PASS }}
|
||||||
|
DB_HOST: ${{ secrets.STAGE_DB_HOST }}
|
||||||
|
DB_PORT: ${{ secrets.STAGE_DB_PORT }}
|
||||||
|
DB_ROOT_HOST: ${{ secrets.STAGE_DB_ROOT_HOST }}
|
||||||
|
DB_SYNC: ${{ secrets.STAGE_DB_SYNC }}
|
||||||
|
DB_LOGGING: ${{ secrets.STAGE_DB_LOGGING }}
|
||||||
|
DB_DATA_LOCATION: ${{ secrets.STAGE_DB_DATA_LOCATION }}
|
||||||
|
SERVER_PATH: ${{ secrets.STAGE_SSH_SERVER_PATH }}
|
||||||
|
BOT_TOKEN: ${{ secrets.STAGE_BOT_TOKEN }}
|
||||||
|
BOT_VER: ${{ vars.STAGE_BOT_VER }}
|
||||||
|
BOT_AUTHOR: ${{ vars.STAGE_BOT_AUTHOR }}
|
||||||
|
BOT_OWNERID: ${{ vars.STAGE_BOT_OWNERID }}
|
||||||
|
BOT_CLIENTID: ${{ vars.STAGE_BOT_CLIENTID }}
|
||||||
|
ABOUT_FUNDING: ${{ vars.STAGE_ABOUT_FUNDING }}
|
||||||
|
ABOUT_REPO: ${{ vars.STAGE_ABOUT_REPO }}
|
||||||
|
CACHE_INTERVAL: ${{ vars.STAGE_CACHE_INTERVAL }}
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.STAGE_SSH_HOST }}
|
||||||
|
username: ${{ secrets.STAGE_SSH_USER }}
|
||||||
|
key: ${{ secrets.STAGE_SSH_KEY }}
|
||||||
|
port: ${{ secrets.STAGE_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_prod \
|
||||||
|
&& docker compose down \
|
||||||
|
&& (pm2 stop vylbot_prod || true) \
|
||||||
|
&& (pm2 delete vylbot_prod || true) \
|
||||||
|
&& docker compose up -d \
|
||||||
|
&& sleep 10 \
|
||||||
|
&& npm run db:up \
|
||||||
|
&& pm2 start --name vylbot_prod dist/vylbot.js
|
24
.forgejo/workflows/test.yml
Normal file
24
.forgejo/workflows/test.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- feature/*
|
||||||
|
- hotfix/*
|
||||||
|
- renovate/*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
environment: stage
|
||||||
|
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm test
|
1091
package-lock.json
generated
1091
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue