From 4638499e2adeb981fa468797eb6af64e9208f188 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:26:44 +0200 Subject: [PATCH 1/8] removed building from the workflow --- .github/workflows/build-deploy.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 23479b05..c04f556f 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,4 +1,4 @@ -name: Build and Deploy +name: Deploy permissions: {} on: @@ -45,13 +45,6 @@ jobs: npm ci echo "✅ Dependencies installed successfully" - # for now we run without building - # - name: Build the application - # working-directory: /home/vb2007/prod/discordbot - # run: | - # npm run build - # echo "Application built successfully" - - name: Deploying possible new commands working-directory: /home/vb2007/prod/discordbot env: From 8d4adbfc1c86d9bd76d89f7e16336601581baf91 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:26:58 +0200 Subject: [PATCH 2/8] renamed workflow file --- .github/workflows/{build-deploy.yml => deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-deploy.yml => deploy.yml} (100%) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/deploy.yml similarity index 100% rename from .github/workflows/build-deploy.yml rename to .github/workflows/deploy.yml From 93cae01ad3b225031fd6119017d961bef59fa22c Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:29:04 +0200 Subject: [PATCH 3/8] updated app version in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aeb81104..7feb10b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discordbot", - "version": "4.0.1", + "version": "4.1.1", "description": "A simple discord bot of mine developed with discord.js (Node.js).", "type": "module", "main": "index.js", From 02d19fdfb784c004d81dd0b4b248a8a02c88c66d Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:30:18 +0200 Subject: [PATCH 4/8] created gh release workflow file --- .github/workflows/gh-release.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/gh-release.yml diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 00000000..e41e46a1 --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -0,0 +1 @@ +name: Release on GitHub From 4c7d209744e1753f57735f23044df30d05e55051 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:41:44 +0200 Subject: [PATCH 5/8] added logic for gh release workflow --- .github/workflows/gh-release.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml index e41e46a1..6bc25396 100644 --- a/.github/workflows/gh-release.yml +++ b/.github/workflows/gh-release.yml @@ -1 +1,42 @@ name: Release on GitHub + +on: + push: + branches: [main] + +jobs: + release: + 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 "Release ${{ steps.package-version.outputs.version }}" \ + --generate-notes \ + --latest \ + ./src/data/commandData.csv From 4aa97e16c17a9ad2203cd679bacb8c5eba7ac2e3 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:47:04 +0200 Subject: [PATCH 6/8] added write permissions to gh release workflow --- .github/workflows/gh-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml index 6bc25396..066dda5f 100644 --- a/.github/workflows/gh-release.yml +++ b/.github/workflows/gh-release.yml @@ -1,5 +1,8 @@ name: Release on GitHub +permissions: + contents: write + on: push: branches: [main] From 83709a566b060d9b43136a0b68c8638b6673182d Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 01:51:22 +0200 Subject: [PATCH 7/8] added comment for gh cli installation --- .github/workflows/gh-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml index 066dda5f..1e163897 100644 --- a/.github/workflows/gh-release.yml +++ b/.github/workflows/gh-release.yml @@ -9,13 +9,14 @@ on: 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 + fetch-depth: 0 #fetch full history for changelog generation - name: Get version from package.json id: package-version From 82e8eefaf2ca4ab71b6acf35c6de2f2688e0e844 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sun, 26 Oct 2025 02:14:49 +0100 Subject: [PATCH 8/8] updated gh release title format in workflow --- .github/workflows/gh-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml index 1e163897..5b17753f 100644 --- a/.github/workflows/gh-release.yml +++ b/.github/workflows/gh-release.yml @@ -40,7 +40,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: | gh release create "${{ steps.package-version.outputs.version }}" \ - --title "Release ${{ steps.package-version.outputs.version }}" \ + --title "${{ steps.package-version.outputs.version }}" \ --generate-notes \ --latest \ ./src/data/commandData.csv