Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Vylpes committed Jun 12, 2024
2 parents 7385a1b + 0a759ed commit 7a352a8
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 171 deletions.
73 changes: 0 additions & 73 deletions .forgejo/workflows/production.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .forgejo/workflows/stage.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .forgejo/workflows/test.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deploy To Prod

on:
workflow_dispatch:
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 Prod Server
uses: D3rHase/rsync-deploy-action@v0.2
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/ssh-action@v1.0.0
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 }}
DB_CARD_FILE: ${{ secrets.DB_CARD_FILE }}
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_REPO }}
DATA_DIR: ${{ secrets.DATA_DIR }}
EXPRESS_PORT: ${{ secrets.EXPRESS_PORT }}
GDRIVESYNC_AUTO: ${{ vars.GDRIVESYNC_AUTO }}
BOT_ADMINS: ${{ vars.BOT_ADMINS }}
BOT_ENV: ${{ vars.BOT_ENV }}
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_CARD_FILE,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,DATA_DIR,EXPRESS_PORT,GDRIVESYNC_AUTO,BOT_ADMINS,BOT_ENV
script: |
cd ${{ secrets.SSH_SERVER_PATH }} \
&& docker compose down \
&& (pm2 stop carddrop_prod || true) \
&& (pm2 delete carddrop_prod || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn run db:up \
&& pm2 start --name carddrop_prod dist/bot.js
78 changes: 78 additions & 0 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy To Stage

on:
workflow_dispatch:
push:
branches:
- develop

jobs:
build:
environment: stage

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

- name: RSync to Stage Server
uses: D3rHase/rsync-deploy-action@v0.2
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: stage
needs: build
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1.0.0
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 }}
DB_CARD_FILE: ${{ secrets.DB_CARD_FILE }}
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_REPO }}
DATA_DIR: ${{ secrets.DATA_DIR }}
EXPRESS_PORT: ${{ secrets.EXPRESS_PORT }}
GDRIVESYNC_AUTO: ${{ vars.GDRIVESYNC_AUTO }}
BOT_ADMINS: ${{ vars.BOT_ADMINS }}
BOT_ENV: ${{ vars.BOT_ENV }}
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_CARD_FILE,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,BOT_TOKEN,BOT_VER,BOT_AUTHOR,BOT_OWNERID,BOT_CLIENTID,ABOUT_FUNDING,ABOUT_REPO,DATA_DIR,EXPRESS_PORT,GDRIVESYNC_AUTO,BOT_ADMINS,BOT_ENV
script: |
cd ${{ secrets.SSH_SERVER_PATH }} \
&& docker compose down \
&& (pm2 stop carddrop_stage || true) \
&& (pm2 delete carddrop_stage || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn run db:up \
&& pm2 start --name carddrop_stage dist/bot.js
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on:
push:
branches:
- feature/*
- hotfix/*
- renovate/*

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

0 comments on commit 7a352a8

Please sign in to comment.