Skip to content

Commit ec10f20

Browse files
committed
🤖 ci: run deploy command in existing container using docker compose
1 parent 3d1ef3c commit ec10f20

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎.github/workflows/deploy-commands.yml‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
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+
1119
- name: Deploy Discord Commands to VPS
1220
uses: appleboy/[email protected]
1321
with:
@@ -16,14 +24,14 @@ jobs:
1624
key: ${{ secrets.VPS_SSH_KEY }}
1725
script: |
1826
cd /home/${{ secrets.VPS_USER }}/webdev-bot-deploy
19-
20-
# Load environment variables
21-
source .env
22-
source .env.production
23-
export NODE_ENV=production
24-
25-
# Run the deploy script
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
2634
echo "Deploying Discord commands..."
27-
node dist/util/deploy.js
28-
35+
docker compose --profile prod exec bot-prod node dist/util/deploy.js
36+
2937
echo "Discord commands deployment completed!"

0 commit comments

Comments
 (0)