Skip to content

Commit 1df0df2

Browse files
Feature/discord rpc migration (#75)
* chore: update workflow and Discord RPC migration integration * fix(ci): stop pushing version bumps from protected branch workflows --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent f207c5f commit 1df0df2

1 file changed

Lines changed: 2 additions & 82 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -21,108 +21,29 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
# ─── Job 1: Run all unit tests (+ bump version on push events) ────────────────
24+
# ─── Job 1: Run all unit tests ────────────────────────────────────────────────
2525
test:
2626
name: Unit Tests
2727
runs-on: ubuntu-22.04
28-
# Version bump needs write access on push events; PRs only need read
2928
permissions:
30-
contents: write
31-
32-
outputs:
33-
new-version: ${{ steps.bump.outputs.new-version }}
29+
contents: read
3430

3531
steps:
3632
- name: Checkout
3733
uses: actions/checkout@v6
38-
with:
39-
# Use GITHUB_TOKEN so the bot can push the version bump commit back
40-
token: ${{ secrets.GITHUB_TOKEN }}
4134

4235
- name: Setup Node.js
4336
uses: actions/setup-node@v6
4437
with:
4538
node-version: '24'
4639
cache: 'npm'
4740

48-
# ── Version bump (push events only, not PRs, not uat) ─────────────────────
49-
# Display version format: RELEASE.BETA.ALPHA.BUILD (stored in build.extraMetadata.version)
50-
# Semver format: RELEASE.BETA.ALPHA (stored in version — required by electron-builder)
51-
#
52-
# develop → increment BUILD (4th digit only)
53-
# alpha → increment ALPHA (3rd digit), reset BUILD to 0
54-
# beta → increment BETA (2nd digit), reset ALPHA and BUILD to 0
55-
# main → increment RELEASE (1st digit), reset BETA/ALPHA/BUILD to 0, tag release/X.0.0.0
56-
- name: Bump version
57-
id: bump
58-
if: github.event_name == 'push' && github.ref_name != 'uat' && github.actor != 'dependabot[bot]'
59-
run: |
60-
# Read the 4-part display version from extraMetadata
61-
EXT_VERSION=$(node -p "require('./package.json').build.extraMetadata.version")
62-
IFS='.' read -r RELEASE BETA ALPHA BUILD <<< "$EXT_VERSION"
63-
64-
case "${{ github.ref_name }}" in
65-
develop)
66-
BUILD=$((BUILD + 1))
67-
;;
68-
alpha)
69-
ALPHA=$((ALPHA + 1))
70-
BUILD=0
71-
;;
72-
beta)
73-
BETA=$((BETA + 1))
74-
ALPHA=0
75-
BUILD=0
76-
;;
77-
main)
78-
RELEASE=$((RELEASE + 1))
79-
BETA=0
80-
ALPHA=0
81-
BUILD=0
82-
;;
83-
esac
84-
85-
NEW_EXT_VERSION="${RELEASE}.${BETA}.${ALPHA}.${BUILD}"
86-
# 3-part semver for electron-builder (strips the BUILD digit)
87-
NEW_VERSION="${RELEASE}.${BETA}.${ALPHA}"
88-
89-
node -e "
90-
const fs = require('fs');
91-
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
92-
pkg.version = '${NEW_VERSION}';
93-
pkg.build.extraMetadata.version = '${NEW_EXT_VERSION}';
94-
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
95-
"
96-
echo "new-version=${NEW_EXT_VERSION}" >> "$GITHUB_OUTPUT"
97-
echo "Bumped to: ${NEW_EXT_VERSION} (semver: ${NEW_VERSION})"
98-
9941
- name: Install dependencies
10042
run: npm ci
10143

10244
- name: Run unit tests
10345
run: npm run test:run
10446

105-
# Push the version bump commit AFTER tests pass so a failed test doesn't
106-
# advance the version counter.
107-
- name: Commit and push version bump
108-
if: github.event_name == 'push' && github.ref_name != 'uat' && github.actor != 'dependabot[bot]' && steps.bump.outputs.new-version != ''
109-
run: |
110-
NEW_VERSION="${{ steps.bump.outputs.new-version }}"
111-
git config user.name "github-actions[bot]"
112-
git config user.email "github-actions[bot]@users.noreply.github.com"
113-
git add package.json
114-
# Only commit if package.json actually changed (idempotent guard)
115-
git diff --cached --quiet || git commit -m "chore: bump version to ${NEW_VERSION} [skip ci]"
116-
git push
117-
118-
# On main: create a release tag after the version bump commit is pushed.
119-
- name: Tag release
120-
if: github.event_name == 'push' && github.ref_name == 'main' && github.actor != 'dependabot[bot]' && steps.bump.outputs.new-version != ''
121-
run: |
122-
TAG="release/${{ steps.bump.outputs.new-version }}"
123-
git tag "$TAG"
124-
git push origin "$TAG"
125-
12647
# ─── Job 2: Build the .deb installer (only runs when all tests pass) ──────────
12748
build:
12849
name: Build Linux DEB
@@ -135,7 +56,6 @@ jobs:
13556
actions: write # required to list and delete artifacts
13657

13758
steps:
138-
# Checkout the branch tip (picks up the version bump commit from the test job)
13959
- name: Checkout
14060
uses: actions/checkout@v6
14161
with:

0 commit comments

Comments
 (0)