Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
db6816a
updated packages
vb2007 Oct 20, 2025
7164d82
refactored deprecated function in /blackjack
vb2007 Oct 20, 2025
adcca23
Merge pull request #160 from vb2007/dev-blackjack-depr-fix
vb2007 Oct 20, 2025
f688c51
updated packages
vb2007 Oct 25, 2025
4d6fa55
created build & deploy gh workflow file
vb2007 Oct 25, 2025
b3e07bd
added job logic for auto deploy
vb2007 Oct 25, 2025
d719a33
added task for deploying new commands
vb2007 Oct 25, 2025
6b0d2b4
added steps for db updates & config.json syntax verification
vb2007 Oct 25, 2025
e6648ba
removed step for config.json syntax verification
vb2007 Oct 25, 2025
6a5ffc9
added missing work dirs, added verifiaction for command deployment
vb2007 Oct 25, 2025
2e7e6b1
added process exit at the end of table create script
vb2007 Oct 25, 2025
c23f307
added output verification for table create script
vb2007 Oct 25, 2025
8a9f415
added multiple branch choice for deploy workflow
vb2007 Oct 25, 2025
a3f0695
added pr trigger for testing
vb2007 Oct 25, 2025
08ed163
updated debug trigger
vb2007 Oct 25, 2025
da090e8
changed node install method
vb2007 Oct 25, 2025
0d7e4f7
removed unused import from create-tables script
vb2007 Oct 25, 2025
c2c10a3
fixed exit code in create-tables
vb2007 Oct 25, 2025
92b88ba
fixed node packag lock delete in workflow
vb2007 Oct 25, 2025
cc28891
updated variables in workflow
vb2007 Oct 25, 2025
3fb99d8
added .env variable checks to command deploy script
vb2007 Oct 25, 2025
3c21fd6
fixed extra variable in script
vb2007 Oct 25, 2025
e558c90
added extra echos for debugging workflow
vb2007 Oct 25, 2025
05cbf84
removed debug logs
vb2007 Oct 25, 2025
4f38ed2
added env paths to jobs that use npm
vb2007 Oct 25, 2025
9dccfbc
updated echo formatting
vb2007 Oct 25, 2025
b609683
temporarly changed default branch
vb2007 Oct 25, 2025
676b4a2
fixed test branch
vb2007 Oct 25, 2025
84b03b7
removed debug triggers
vb2007 Oct 25, 2025
65b322d
supressed codeql permission warnings
vb2007 Oct 25, 2025
005b358
Merge pull request #162 from vb2007/dev-release-ci
vb2007 Oct 25, 2025
4638499
removed building from the workflow
vb2007 Oct 25, 2025
8d4adbf
renamed workflow file
vb2007 Oct 25, 2025
93cae01
updated app version in package.json
vb2007 Oct 25, 2025
02d19fd
created gh release workflow file
vb2007 Oct 25, 2025
4c7d209
added logic for gh release workflow
vb2007 Oct 25, 2025
4aa97e1
added write permissions to gh release workflow
vb2007 Oct 25, 2025
83709a5
added comment for gh cli installation
vb2007 Oct 25, 2025
82e8eef
updated gh release title format in workflow
vb2007 Oct 26, 2025
3e11e86
Merge pull request #163 from vb2007/dev-gh-release-ci
vb2007 Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Deploy
permissions: {}

on:
push:
branches: [main]
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: "main"
type: string

jobs:
deploy:
runs-on: self-hosted # REQUIRES SOME SUDO EXECUTION PRIVILEGES WITHOUT A PASSWORD PROMPT

steps:
- name: Stopping systemd service
run: sudo systemctl stop discordbot

- name: Pulling latest changes
working-directory: /home/vb2007/prod/discordbot
run: |
BRANCH="${{ github.event.inputs.branch || 'main' }}"
echo "Deploying branch: $BRANCH"
git fetch origin
git reset --hard origin/$BRANCH
git clean -fd
echo "✅ Successfully pulled latest changes from $BRANCH"

# i use manual node paths and manage version manually w/ nvm
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "24.8.0"

- name: Intalling Node.js dependencies
working-directory: /home/vb2007/prod/discordbot
env:
PATH: /home/vb2007/.nvm/versions/node/v24.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
run: |
rm -rf node_modules
npm ci
echo "✅ Dependencies installed successfully"

- name: Deploying possible new commands
working-directory: /home/vb2007/prod/discordbot
env:
PATH: /home/vb2007/.nvm/versions/node/v24.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
run: |
echo "Starting command deployment..."
deployOutput=$(npm run deploy 2>&1)
echo "$deployOutput"

if echo "$deployOutput" | grep -q "Registered .* slash (/) commands at Discord"; then
echo "✅ Command deployment successful"
else
echo "❌ Command deployment failed"
exit 1
fi
sleep 8

- name: Updating command data
working-directory: /home/vb2007/prod/discordbot
env:
PATH: /home/vb2007/.nvm/versions/node/v24.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
run: |
echo "Starting table creation and command data update..."
queriesOutput=$(npm run create-tables 2>&1)
echo "$queriesOutput"

if echo "$queriesOutput" | grep -q "All queries are executed & all tables are processed." && echo "$queriesOutput" | grep -q "Command data has been updated successfully."; then
echo "✅ Table creation and command data update successful"
else
echo "❌ Table creation or command data update failed"
exit 1
fi
sleep 5

- name: Starting systemd service
run: |
sudo systemctl start discordbot
sleep 5
sudo systemctl status discordbot --no-pager
echo "Systemd service started"

- name: Verifying deployment outcome
run: |
echo "Waiting for the service to start"
sleep 10

if sudo systemctl is-active --quiet discordbot.service; then
echo "✅ Deployment successful - service is running"
else
echo "❌ Deployment failed - service is not running"
sudo systemctl status discordbot.service --no-pager
exit 1
fi
46 changes: 46 additions & 0 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release on GitHub

permissions:
contents: write

on:
push:
branches: [main]

jobs:
release:
#requires gh cli on the runner: https://github.com/cli/cli/blob/trunk/docs/install_linux.md
runs-on: self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch full history for changelog generation

- name: Get version from package.json
id: package-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=v$VERSION" >> $GITHUB_OUTPUT
echo "raw_version=$VERSION" >> $GITHUB_OUTPUT

- name: Check if tag already exists
id: tag-check
run: |
if git tag -l "${{ steps.package-version.outputs.version }}" | grep -q "${{ steps.package-version.outputs.version }}"; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi

- name: Create GitHub Release
if: steps.tag-check.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
gh release create "${{ steps.package-version.outputs.version }}" \
--title "${{ steps.package-version.outputs.version }}" \
--generate-notes \
--latest \
./src/data/commandData.csv
Loading