Deploy Bot Commands #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |