Skip to content

Deploy Bot Commands #27

Deploy Bot Commands

Deploy Bot Commands #27

name: Deploy Bot Commands
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'dev'
type: choice
options:
- 'dev'
- 'prod'
jobs:
deploy-bot-commands-prod:
if : ${{ github.event.inputs.environment == 'prod' }}
runs-on: ubuntu-latest
steps:
- name: SSH and run deploy bot commands on prod
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
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, DISCORD_CLIENT_ID
script: |
cd freeBrunch-discord-bot
git stash && git pull origin main
npm install
export DISCORD_TOKEN=$DISCORD_TOKEN && export DISCORD_CLIENT_ID=$DISCORD_CLIENT_ID && node discord-scripts/deploy-commands.js
deploy-bot-commands-dev:
if : ${{ github.event.inputs.environment == 'dev' }}
runs-on: ubuntu-latest
steps:
- name: SSH and run deploy bot commands on dev
env:
DISCORD_DEV_TOKEN: ${{ secrets.DISCORD_DEV_TOKEN }}
DISCORD_DEV_CLIENT_ID: ${{ secrets.DISCORD_DEV_CLIENT_ID }}
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, DISCORD_DEV_CLIENT_ID
script: |
cd freeBrunch-discord-bot-dev
git stash && git pull origin dev
npm install
export DISCORD_DEV_TOKEN=$DISCORD_DEV_TOKEN && export DISCORD_DEV_CLIENT_ID=$DISCORD_DEV_CLIENT_ID && node discord-scripts/deploy-commands-dev.js