From f688c512652fb7cd5e2f32ac0f32cc9bc6d1f175 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 20:41:49 +0200 Subject: [PATCH 01/27] updated packages --- package-lock.json | 140 +++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b9e02f3..c995ab14 100755 --- a/package-lock.json +++ b/package-lock.json @@ -41,9 +41,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.4.tgz", - "integrity": "sha512-YsmSKC29MJwf0gF8Rjjrg5LQCmyh+j/nD8/eP7f+BeoQTKYqs9RoWbjGOdy0+1Ekr68RJZMUOPVQaQisnIo4Rw==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", "dev": true, "license": "MIT", "engines": { @@ -51,22 +51,22 @@ } }, "node_modules/@babel/core": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.4.tgz", - "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.3", + "@babel/generator": "^7.28.5", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.28.3", "@babel/helpers": "^7.28.4", - "@babel/parser": "^7.28.4", + "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", - "@babel/traverse": "^7.28.4", - "@babel/types": "^7.28.4", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -83,14 +83,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.3.tgz", - "integrity": "sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.28.3", - "@babel/types": "^7.28.2", + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -179,9 +179,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", "dev": true, "license": "MIT", "engines": { @@ -213,13 +213,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.4.tgz", - "integrity": "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.28.4" + "@babel/types": "^7.28.5" }, "bin": { "parser": "bin/babel-parser.js" @@ -483,18 +483,18 @@ } }, "node_modules/@babel/traverse": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.4.tgz", - "integrity": "sha512-YEzuboP2qvQavAcjgQNVgsvHIDv6ZpwXvcvjmyySP2DIMuByS/6ioU5G9pYrWHM6T2YDfc7xga9iNzYOs12CFQ==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.27.1", - "@babel/generator": "^7.28.3", + "@babel/generator": "^7.28.5", "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.4", + "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", - "@babel/types": "^7.28.4", + "@babel/types": "^7.28.5", "debug": "^4.3.1" }, "engines": { @@ -502,14 +502,14 @@ } }, "node_modules/@babel/types": { - "version": "7.28.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.4.tgz", - "integrity": "sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.27.1" + "@babel/helper-validator-identifier": "^7.28.5" }, "engines": { "node": ">=6.9.0" @@ -523,15 +523,15 @@ "license": "MIT" }, "node_modules/@discordjs/builders": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.12.2.tgz", - "integrity": "sha512-AugKmrgRJOHXEyMkABH/hXpAmIBKbYokCEl9VAM4Kh6FvkdobQ+Zhv7AR6K+y5hS7+VQ7gKXPYCe1JQmV07H1g==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.13.0.tgz", + "integrity": "sha512-COK0uU6ZaJI+LA67H/rp8IbEkYwlZf3mAoBI5wtPh5G5cbEQGNhVpzINg2f/6+q/YipnNIKy6fJDg6kMUKUw4Q==", "license": "Apache-2.0", "dependencies": { "@discordjs/formatters": "^0.6.1", "@discordjs/util": "^1.1.1", "@sapphire/shapeshift": "^4.0.0", - "discord-api-types": "^0.38.26", + "discord-api-types": "^0.38.31", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.4", "tslib": "^2.6.3" @@ -1176,9 +1176,9 @@ } }, "node_modules/@types/node": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.0.tgz", - "integrity": "sha512-MKNwXh3seSK8WurXF7erHPJ2AONmMwkI7zAMrXZDPIru8jRqkk6rGDBVbw4mLwfqA+ZZliiDPg05JQ3uW66tKQ==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz", + "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", "license": "MIT", "dependencies": { "undici-types": "~7.16.0" @@ -1201,9 +1201,9 @@ } }, "node_modules/@types/yargs": { - "version": "17.0.33", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", - "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", + "version": "17.0.34", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.34.tgz", + "integrity": "sha512-KExbHVa92aJpw9WDQvzBaGVE2/Pz+pLZQloT2hjL8IqsZnV62rlPOYvNnLmf/L2dyllfVUOVBj64M0z/46eR2A==", "dev": true, "license": "MIT", "dependencies": { @@ -1438,9 +1438,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.8.18", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.18.tgz", - "integrity": "sha512-UYmTpOBwgPScZpS4A+YbapwWuBwasxvO/2IOHArSsAhL/+ZdmATBXTex3t+l2hXwLVYK382ibr/nKoY9GKe86w==", + "version": "2.8.20", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.20.tgz", + "integrity": "sha512-JMWsdF+O8Orq3EMukbUN1QfbLK9mX2CkUmQBcW2T0s8OmdAUL5LLM/6wFwSrqXzlXB13yhyK9gTKS1rIizOduQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -1478,9 +1478,9 @@ } }, "node_modules/browserslist": { - "version": "4.26.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.3.tgz", - "integrity": "sha512-lAUU+02RFBuCKQPj/P6NgjlbCnLBMp4UtgTx7vNHd3XSIJF87s9a5rA3aH2yw3GS9DqZAUbOtZdCCiZeVRqt0w==", + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.27.0.tgz", + "integrity": "sha512-AXVQwdhot1eqLihwasPElhX2tAZiBjWdJ9i/Zcj2S6QYIjkx62OKSfnobkriB81C3l4w0rVy3Nt4jaTBltYEpw==", "dev": true, "funding": [ { @@ -1499,11 +1499,11 @@ "license": "MIT", "peer": true, "dependencies": { - "baseline-browser-mapping": "^2.8.9", - "caniuse-lite": "^1.0.30001746", - "electron-to-chromium": "^1.5.227", - "node-releases": "^2.0.21", - "update-browserslist-db": "^1.1.3" + "baseline-browser-mapping": "^2.8.19", + "caniuse-lite": "^1.0.30001751", + "electron-to-chromium": "^1.5.238", + "node-releases": "^2.0.26", + "update-browserslist-db": "^1.1.4" }, "bin": { "browserslist": "cli.js" @@ -1883,28 +1883,28 @@ } }, "node_modules/discord-api-types": { - "version": "0.38.30", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.30.tgz", - "integrity": "sha512-KhAqlBrg+rVK+Ob7INMF5o63yW4/GUzRatG/AjyVsIO8lgcLyR8qCl2HokIVzWwmzkJYG0CEPXsKMOqau3E8NA==", + "version": "0.38.31", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.31.tgz", + "integrity": "sha512-kC94ANsk8ackj8ENTuO8joTNEL0KtymVhHy9dyEC/s4QAZ7GCx40dYEzQaadyo8w+oP0X8QydE/nzAWRylTGtQ==", "license": "MIT", "workspaces": [ "scripts/actions/documentation" ] }, "node_modules/discord.js": { - "version": "14.23.2", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.23.2.tgz", - "integrity": "sha512-tU2NFr823X3TXEc8KyR/4m296KLxPai4nirN3q9kHCpY4TKj96n9lHZnyLzRNMui8EbL07jg9hgH2PWWfKMGIg==", + "version": "14.24.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.0.tgz", + "integrity": "sha512-KNq/ekT8bsmT3ZAfVre8cPbl+DfVYSdlLnDmGZPoz7Cw21LYeWHllRA9MivqNq5b1GPGAxGvyUN1vxbTb/PQWw==", "license": "Apache-2.0", "dependencies": { - "@discordjs/builders": "^1.12.1", + "@discordjs/builders": "^1.13.0", "@discordjs/collection": "1.5.3", "@discordjs/formatters": "^0.6.1", "@discordjs/rest": "^2.6.0", "@discordjs/util": "^1.1.1", "@discordjs/ws": "^1.2.3", "@sapphire/snowflake": "3.5.3", - "discord-api-types": "^0.38.29", + "discord-api-types": "^0.38.31", "fast-deep-equal": "3.1.3", "lodash.snakecase": "4.1.1", "magic-bytes.js": "^1.10.0", @@ -1995,9 +1995,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.237", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.237.tgz", - "integrity": "sha512-icUt1NvfhGLar5lSWH3tHNzablaA5js3HVHacQimfP8ViEBOQv+L7DKEuHdbTZ0SKCO1ogTJTIL1Gwk9S6Qvcg==", + "version": "1.5.240", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.240.tgz", + "integrity": "sha512-OBwbZjWgrCOH+g6uJsA2/7Twpas2OlepS9uvByJjR2datRDuKGYeD+nP8lBBks2qnB7bGJNHDUx7c/YLaT3QMQ==", "dev": true, "license": "ISC" }, @@ -3476,9 +3476,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.25", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.25.tgz", - "integrity": "sha512-4auku8B/vw5psvTiiN9j1dAOsXvMoGqJuKJcR+dTdqiXEK20mMTk1UEo3HS16LeGQsVG6+qKTPM9u/qQ2LqATA==", + "version": "2.0.26", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.26.tgz", + "integrity": "sha512-S2M9YimhSjBSvYnlr5/+umAnPHE++ODwt5e2Ij6FoX45HA/s4vHdkDx1eax2pAPeAOqu4s9b7ppahsyEFdVqQA==", "dev": true, "license": "MIT" }, @@ -4192,9 +4192,9 @@ "license": "MIT" }, "node_modules/update-browserslist-db": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", - "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz", + "integrity": "sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==", "dev": true, "funding": [ { From 4d6fa5559c4551965b41b905827a997e11d20168 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 20:43:09 +0200 Subject: [PATCH 02/27] created build & deploy gh workflow file --- .github/workflows/build-deploy.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/workflows/build-deploy.yml diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 00000000..1f062fbc --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,6 @@ +name: Build and Deploy + +on: + push: + branches: [main] + workflow_dispatch: From b3e07bd4cbf2202e88526ce0483320fb8180af47 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 20:49:09 +0200 Subject: [PATCH 03/27] added job logic for auto deploy --- .github/workflows/build-deploy.yml | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 1f062fbc..4acd02cf 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -4,3 +4,53 @@ on: push: branches: [main] workflow_dispatch: + +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: | + git fetch origin + git reset --hard origin/main + git clean -fd + echo "Successfully pulled latest changes" + + - name: Intalling Node.js dependencies + working-directory: /home/vb2007/prod/discordbot + run: | + # Clean install to ensure fresh dependencies + rm -rf node_modules package-lock.json + npm install + echo "Dependencies installed successfully" + + # - name: Build the application # for now we run without building + # working-directory: /home/vb2007/prod/discordbot + # run: | + # npm run build + # echo "Application built successfully" + + - name: Starting systemd service + run: | + sudo systemctl start discordbot + sleep 5 + sudo systemctl status discordbot --no-pager + echo "Service started and status checked" + + - 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 From d719a3386757a4f2ac05f0a30bc3b424fe5b0974 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 20:57:18 +0200 Subject: [PATCH 04/27] added task for deploying new commands --- .github/workflows/build-deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 4acd02cf..90f1114a 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -35,6 +35,11 @@ jobs: # npm run build # echo "Application built successfully" + - name: Deploying possible new commands + run: | + npm run deploy + sleep 8 + - name: Starting systemd service run: | sudo systemctl start discordbot From 6b0d2b48063b90388b89e442828ae4a131555c34 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:01:23 +0200 Subject: [PATCH 05/27] added steps for db updates & config.json syntax verification --- .github/workflows/build-deploy.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 90f1114a..3ca1aa35 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -35,17 +35,27 @@ jobs: # npm run build # echo "Application built successfully" + - name: Verifying the config.json file's syntax + run: | + npm run verify-config + sleep 3 + - name: Deploying possible new commands run: | npm run deploy sleep 8 + - name: Updating command data + run: | + npm run create-tables + sleep 5 + - name: Starting systemd service run: | sudo systemctl start discordbot sleep 5 sudo systemctl status discordbot --no-pager - echo "Service started and status checked" + echo "Systemd service started" - name: Verifying deployment outcome run: | From e6648ba88b6ca900fa25c54b0de94ae3b615c7af Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:02:43 +0200 Subject: [PATCH 06/27] removed step for config.json syntax verification --- .github/workflows/build-deploy.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 3ca1aa35..268f7a15 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -35,11 +35,6 @@ jobs: # npm run build # echo "Application built successfully" - - name: Verifying the config.json file's syntax - run: | - npm run verify-config - sleep 3 - - name: Deploying possible new commands run: | npm run deploy From 6a5ffc961cdca8839d0909181726dd6e1ff46261 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:12:15 +0200 Subject: [PATCH 07/27] added missing work dirs, added verifiaction for command deployment --- .github/workflows/build-deploy.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 268f7a15..6fbf2e48 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -36,11 +36,22 @@ jobs: # echo "Application built successfully" - name: Deploying possible new commands + working-directory: /home/vb2007/prod/discordbot run: | - npm run deploy + echo "Starting command deployment..." + deployment_output=$(npm run deploy 2>&1) + echo "$deployment_output" + + if echo "$deployment_output" | 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 run: | npm run create-tables sleep 5 From 2e7e6b1e2c17c325f30f9e303354bdcb5ce81400 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:21:32 +0200 Subject: [PATCH 08/27] added process exit at the end of table create script --- src/create-tables.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/create-tables.js b/src/create-tables.js index eefcb732..6a7991a3 100644 --- a/src/create-tables.js +++ b/src/create-tables.js @@ -2,6 +2,7 @@ import fs from "fs"; import path from "path"; import { fileURLToPath } from "url"; import { query, getConnection } from "./helpers/db.js"; +import { exit } from "process"; getConnection(); const __filename = fileURLToPath(import.meta.url); @@ -107,6 +108,7 @@ const createTables = async () => { const init = async () => { await createTables(); await updateCommandData(); + process.exit(); }; init(); From c23f307ab0d4674e4d68a60822bb5c0db9970d2d Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:27:37 +0200 Subject: [PATCH 09/27] added output verification for table create script --- .github/workflows/build-deploy.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 6fbf2e48..b223249b 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -39,10 +39,10 @@ jobs: working-directory: /home/vb2007/prod/discordbot run: | echo "Starting command deployment..." - deployment_output=$(npm run deploy 2>&1) - echo "$deployment_output" + output=$(npm run deploy 2>&1) + echo "$output" - if echo "$deployment_output" | grep -q "Registered .* slash (/) commands at Discord"; then + if echo "$output" | grep -q "Registered .* slash (/) commands at Discord"; then echo "✅ Command deployment successful" else echo "❌ Command deployment failed" @@ -53,7 +53,16 @@ jobs: - name: Updating command data working-directory: /home/vb2007/prod/discordbot run: | - npm run create-tables + echo "Starting table creation and command data update..." + output=$(npm run create-tables 2>&1) + echo "$output" + + if echo "$output" | grep -q "All queries are executed & all tables are processed." && echo "$table_output" | 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 From 8a9f415dc8bfdf8f44f90c50ca573dcfa9f335ad Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:38:57 +0200 Subject: [PATCH 10/27] added multiple branch choice for deploy workflow --- .github/workflows/build-deploy.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index b223249b..4e003f1a 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -4,6 +4,12 @@ on: push: branches: [main] workflow_dispatch: + inputs: + branch: + description: "Branch to deploy" + required: true + default: "main" + type: string jobs: deploy: @@ -16,10 +22,12 @@ jobs: - 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/main + git reset --hard origin/$BRANCH git clean -fd - echo "Successfully pulled latest changes" + echo "Successfully pulled latest changes from $BRANCH" - name: Intalling Node.js dependencies working-directory: /home/vb2007/prod/discordbot From a3f0695bb8cb40794c7ddf98a5f80a2c86af8dbd Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:40:58 +0200 Subject: [PATCH 11/27] added pr trigger for testing --- .github/workflows/build-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 4e003f1a..16a59ec1 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -3,6 +3,8 @@ name: Build and Deploy on: push: branches: [main] + pull_request: + branches: [dev] workflow_dispatch: inputs: branch: From 08ed163534f2f30c25b44e979d56db1bd415a275 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:49:57 +0200 Subject: [PATCH 12/27] updated debug trigger --- .github/workflows/build-deploy.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 16a59ec1..185150de 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -2,9 +2,7 @@ name: Build and Deploy on: push: - branches: [main] - pull_request: - branches: [dev] + branches: [main, dev-release-ci] workflow_dispatch: inputs: branch: From da090e8e9f1aa8cf494cf4a33e932420f2f6575a Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 21:55:06 +0200 Subject: [PATCH 13/27] changed node install method --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 185150de..3ec43c1c 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -34,7 +34,7 @@ jobs: run: | # Clean install to ensure fresh dependencies rm -rf node_modules package-lock.json - npm install + npm ci echo "Dependencies installed successfully" # - name: Build the application # for now we run without building From 0d7e4f797ff6e14ddc0d0126fda7b865c51413ca Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 22:01:46 +0200 Subject: [PATCH 14/27] removed unused import from create-tables script --- .github/workflows/build-deploy.yml | 4 ++-- src/create-tables.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 3ec43c1c..125322bc 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -32,12 +32,12 @@ jobs: - name: Intalling Node.js dependencies working-directory: /home/vb2007/prod/discordbot run: | - # Clean install to ensure fresh dependencies rm -rf node_modules package-lock.json npm ci echo "Dependencies installed successfully" - # - name: Build the application # for now we run without building + # for now we run without building + # - name: Build the application # working-directory: /home/vb2007/prod/discordbot # run: | # npm run build diff --git a/src/create-tables.js b/src/create-tables.js index 6a7991a3..0a8c2f97 100644 --- a/src/create-tables.js +++ b/src/create-tables.js @@ -2,7 +2,6 @@ import fs from "fs"; import path from "path"; import { fileURLToPath } from "url"; import { query, getConnection } from "./helpers/db.js"; -import { exit } from "process"; getConnection(); const __filename = fileURLToPath(import.meta.url); From c2c10a33b628e7e5fd66e419bdbd94d4e5158ec4 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 22:58:30 +0200 Subject: [PATCH 15/27] fixed exit code in create-tables --- src/create-tables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/create-tables.js b/src/create-tables.js index 0a8c2f97..cf1412fb 100644 --- a/src/create-tables.js +++ b/src/create-tables.js @@ -107,7 +107,7 @@ const createTables = async () => { const init = async () => { await createTables(); await updateCommandData(); - process.exit(); + process.exit(0); }; init(); From 92b88ba7e2573e4bdc2f1ad839aec5955fdd0573 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 22:59:25 +0200 Subject: [PATCH 16/27] fixed node packag lock delete in workflow --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 125322bc..b2ae6205 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -32,7 +32,7 @@ jobs: - name: Intalling Node.js dependencies working-directory: /home/vb2007/prod/discordbot run: | - rm -rf node_modules package-lock.json + rm -rf node_modules npm ci echo "Dependencies installed successfully" From cc288910be2c9bda558e0127a2ed0fe7dec02a59 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:01:55 +0200 Subject: [PATCH 17/27] updated variables in workflow --- .github/workflows/build-deploy.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index b2ae6205..41e4deff 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -47,10 +47,10 @@ jobs: working-directory: /home/vb2007/prod/discordbot run: | echo "Starting command deployment..." - output=$(npm run deploy 2>&1) - echo "$output" + deployOutput=$(npm run deploy 2>&1) + echo "$deployOutput" - if echo "$output" | grep -q "Registered .* slash (/) commands at Discord"; then + if echo "$deployOutput" | grep -q "Registered .* slash (/) commands at Discord"; then echo "✅ Command deployment successful" else echo "❌ Command deployment failed" @@ -62,10 +62,10 @@ jobs: working-directory: /home/vb2007/prod/discordbot run: | echo "Starting table creation and command data update..." - output=$(npm run create-tables 2>&1) - echo "$output" + queriesOutput=$(npm run create-tables 2>&1) + echo "$queriesOutput" - if echo "$output" | grep -q "All queries are executed & all tables are processed." && echo "$table_output" | grep -q "Command data has been updated successfully."; then + 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" From 3fb99d8048a96198565dddff27b0d9dc20e4d5c5 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:04:39 +0200 Subject: [PATCH 18/27] added .env variable checks to command deploy script --- src/deploy-commands.js | 10 ++++++++++ src/index.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/deploy-commands.js b/src/deploy-commands.js index e2b36193..2105f622 100644 --- a/src/deploy-commands.js +++ b/src/deploy-commands.js @@ -7,6 +7,16 @@ import "dotenv/config"; const token = process.env.TOKEN; const clientId = process.env.CLIENT_ID; +if (!token) { + console.error("[FATAL] Bot token is missing. Set TOKEN in the .env file."); + process.exit(1); +} + +if (!clientId) { + console.error("[FATAL] Bot client Id token is missing. Set CLIENT_ID in the .env file."); + process.exit(1); + CLIENT_ID; + const commands = []; const __filename = fileURLToPath(import.meta.url); diff --git a/src/index.js b/src/index.js index 2d731e88..dd9e290f 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,7 @@ import { runDarwinProcess } from "./helpers/darwin/darwinProcess.js"; import { validateConfig } from "./scripts/verify-config-syntax.js"; if (!token) { - console.error("[FATAL] Discord bot token is missing. Please set TOKEN in your .env file."); + console.error("[FATAL] Bot token is missing. Set TOKEN in the .env file."); process.exit(1); } From 3c21fd6eacbfff8606d8f30635eb6abc12ae8818 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:08:30 +0200 Subject: [PATCH 19/27] fixed extra variable in script --- src/deploy-commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deploy-commands.js b/src/deploy-commands.js index 2105f622..6a0600ea 100644 --- a/src/deploy-commands.js +++ b/src/deploy-commands.js @@ -15,7 +15,7 @@ if (!token) { if (!clientId) { console.error("[FATAL] Bot client Id token is missing. Set CLIENT_ID in the .env file."); process.exit(1); - CLIENT_ID; +} const commands = []; From e558c900fc3bfa7508fc927e3d9d6cdb12c56829 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:14:14 +0200 Subject: [PATCH 20/27] added extra echos for debugging workflow --- .github/workflows/build-deploy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 41e4deff..025d95b4 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -47,8 +47,14 @@ jobs: working-directory: /home/vb2007/prod/discordbot run: | echo "Starting command deployment..." + + echo "Running npm run deploy directly:" + npm run deploy || echo "Direct command failed with exit code $?" + + echo "Now capturing output for parsing:" deployOutput=$(npm run deploy 2>&1) - echo "$deployOutput" + echo "Captured output: '$deployOutput'" + echo "Length of output: ${#deployOutput}" if echo "$deployOutput" | grep -q "Registered .* slash (/) commands at Discord"; then echo "✅ Command deployment successful" From 05cbf84e266231e11fa9c52b559d6c8b4c6aced1 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:20:40 +0200 Subject: [PATCH 21/27] removed debug logs --- .github/workflows/build-deploy.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 025d95b4..41e4deff 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -47,14 +47,8 @@ jobs: working-directory: /home/vb2007/prod/discordbot run: | echo "Starting command deployment..." - - echo "Running npm run deploy directly:" - npm run deploy || echo "Direct command failed with exit code $?" - - echo "Now capturing output for parsing:" deployOutput=$(npm run deploy 2>&1) - echo "Captured output: '$deployOutput'" - echo "Length of output: ${#deployOutput}" + echo "$deployOutput" if echo "$deployOutput" | grep -q "Registered .* slash (/) commands at Discord"; then echo "✅ Command deployment successful" From 4f38ed24bceb4f7b6fd5211a092e18488ff6eee2 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:26:50 +0200 Subject: [PATCH 22/27] added env paths to jobs that use npm --- .github/workflows/build-deploy.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 41e4deff..543678e1 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -29,8 +29,16 @@ jobs: 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 @@ -45,6 +53,8 @@ jobs: - 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) @@ -60,6 +70,8 @@ jobs: - 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) From 9dccfbc513f587d20341dc8cf61634da544a6a99 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:40:40 +0200 Subject: [PATCH 23/27] updated echo formatting --- .github/workflows/build-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 543678e1..78382aa7 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -27,7 +27,7 @@ jobs: git fetch origin git reset --hard origin/$BRANCH git clean -fd - echo "Successfully pulled latest changes from $BRANCH" + echo "✅ Successfully pulled latest changes from $BRANCH" # i use manual node paths and manage version manually w/ nvm # - name: Setup Node.js @@ -42,7 +42,7 @@ jobs: run: | rm -rf node_modules npm ci - echo "Dependencies installed successfully" + echo "✅ Dependencies installed successfully" # for now we run without building # - name: Build the application From b6096838d29fca901032f2bfb7bc53a3b2ab1af4 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:41:00 +0200 Subject: [PATCH 24/27] temporarly changed default branch --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 78382aa7..6c15c5ea 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -8,7 +8,7 @@ on: branch: description: "Branch to deploy" required: true - default: "main" + default: "dev-release-ci" type: string jobs: From 676b4a267f3541f542859ca12a43eedbb2d5f81e Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:42:25 +0200 Subject: [PATCH 25/27] fixed test branch --- .github/workflows/build-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 6c15c5ea..240fe6cc 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -8,7 +8,7 @@ on: branch: description: "Branch to deploy" required: true - default: "dev-release-ci" + default: "main" type: string jobs: @@ -22,7 +22,7 @@ jobs: - name: Pulling latest changes working-directory: /home/vb2007/prod/discordbot run: | - BRANCH="${{ github.event.inputs.branch || 'main' }}" + BRANCH="${{ github.event.inputs.branch || 'dev-release-ci' }}" echo "Deploying branch: $BRANCH" git fetch origin git reset --hard origin/$BRANCH From 84b03b7fe45622543f39d3030c00918f4553668e Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:44:00 +0200 Subject: [PATCH 26/27] removed debug triggers --- .github/workflows/build-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 240fe6cc..cfec7b06 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -2,7 +2,7 @@ name: Build and Deploy on: push: - branches: [main, dev-release-ci] + branches: [main] workflow_dispatch: inputs: branch: @@ -22,7 +22,7 @@ jobs: - name: Pulling latest changes working-directory: /home/vb2007/prod/discordbot run: | - BRANCH="${{ github.event.inputs.branch || 'dev-release-ci' }}" + BRANCH="${{ github.event.inputs.branch || 'main' }}" echo "Deploying branch: $BRANCH" git fetch origin git reset --hard origin/$BRANCH From 65b322d9d4bd7eea16a9b1bd3e1152595bb20ee9 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 25 Oct 2025 23:45:40 +0200 Subject: [PATCH 27/27] supressed codeql permission warnings --- .github/workflows/build-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index cfec7b06..23479b05 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,4 +1,5 @@ name: Build and Deploy +permissions: {} on: push: