Skip to content

Recreate codeql.yml #196

Recreate codeql.yml

Recreate codeql.yml #196

Workflow file for this run

name: Deploy Discord Bot
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'dev'
type: choice
options:
- 'dev'
- 'prod'
push:
branches:
- main
- dev
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
deploy-bot-prod:
if : ${{ (github.event.inputs.environment == 'prod' && github.event_name == 'workflow_dispatch') || (github.ref == 'refs/heads/main' && github.event_name == 'push') }}
runs-on: ubuntu-latest
steps:
- name: SSH and restart updated discord bot
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
APEX_API_KEY: ${{ secrets.APEX_API_KEY }}
RIOT_TFT_API_KEY: ${{ secrets.RIOT_TFT_API_KEY }}
RIOT_LOL_API_KEY: ${{ secrets.RIOT_LOL_API_KEY }}
RAWG_API_KEY: ${{ secrets.RAWG_API_KEY }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: ${{ secrets.SSH_PORT }}
envs: DISCORD_TOKEN, APEX_API_KEY, RIOT_TFT_API_KEY, RIOT_LOL_API_KEY, RAWG_API_KEY
script: |
cd freeBrunch-discord-bot
git fetch origin main
git reset --hard origin/main
npm install
export DISCORD_TOKEN=$DISCORD_TOKEN && export RAWG_API_KEY=$RAWG_API_KEY && export RIOT_TFT_API_KEY=$RIOT_TFT_API_KEY && export RIOT_LOL_API_KEY=$RIOT_LOL_API_KEY && export APEX_API_KEY=$APEX_API_KEY && export NODE_ENV=production && pm2 restart freeBrunch-bot --update-env
deploy-bot-dev:
if : ${{ (github.event.inputs.environment == 'dev' && github.event_name == 'workflow_dispatch') || (github.ref == 'refs/heads/dev' && github.event_name == 'push') }}
runs-on: ubuntu-latest
steps:
- name: SSH and restart updated discord dev bot
env:
DISCORD_DEV_TOKEN: ${{ secrets.DISCORD_DEV_TOKEN }}
APEX_API_KEY: ${{ secrets.APEX_API_KEY }}
RIOT_TFT_API_KEY: ${{ secrets.RIOT_TFT_API_KEY }}
RIOT_LOL_API_KEY: ${{ secrets.RIOT_LOL_API_KEY }}
RAWG_API_KEY: ${{ secrets.RAWG_API_KEY }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: ${{ secrets.SSH_PORT }}
envs: DISCORD_DEV_TOKEN, APEX_API_KEY, RIOT_TFT_API_KEY, RIOT_LOL_API_KEY, RAWG_API_KEY
script: |
cd freeBrunch-discord-bot-dev
git fetch origin dev
git reset --hard origin/dev
npm install
export DISCORD_DEV_TOKEN=$DISCORD_DEV_TOKEN && export RAWG_API_KEY=$RAWG_API_KEY && export RIOT_TFT_API_KEY=$RIOT_TFT_API_KEY && export RIOT_LOL_API_KEY=$RIOT_LOL_API_KEY && export APEX_API_KEY=$APEX_API_KEY && export NODE_ENV=development && pm2 restart freeBrunch-bot-dev --update-env