Skip to content

Commit 8c8882d

Browse files
authored
🤖 ci: add GitHub Actions workflow for deploying Discord commands to VPS (#35)
* 🤖 ci: add GitHub Actions workflow for deploying Discord commands to VPS * 🐛 fix: update deploy commands script to load environment variables from .env files * 🤖 ci: run deploy command in existing container using `docker compose`
1 parent 60b3f4f commit 8c8882d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Discord Commands
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
6+
jobs:
7+
deploy-commands:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Read Node version
15+
run: |
16+
NODE_VERSION=$(cat .nvmrc | sed 's/v//')
17+
echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV
18+
19+
- name: Deploy Discord Commands to VPS
20+
uses: appleboy/[email protected]
21+
with:
22+
host: ${{ secrets.VPS_HOST }}
23+
username: ${{ secrets.VPS_USER }}
24+
key: ${{ secrets.VPS_SSH_KEY }}
25+
script: |
26+
cd /home/${{ secrets.VPS_USER }}/webdev-bot-deploy
27+
28+
# Read NODE_VERSION from .nvmrc
29+
export NODE_VERSION=$(cat .nvmrc | sed 's/v//')
30+
echo "Using Node version: $NODE_VERSION"
31+
32+
# Run deploy script inside the already running Docker container
33+
# .env file should already exist from main deployment
34+
echo "Deploying Discord commands..."
35+
docker compose --profile prod exec bot-prod node dist/util/deploy.js
36+
37+
echo "Discord commands deployment completed!"

0 commit comments

Comments
 (0)