diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/deploy.yml similarity index 93% rename from .github/workflows/build-deploy.yml rename to .github/workflows/deploy.yml index 23479b05..c04f556f 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/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: diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 00000000..5b17753f --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -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 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",