Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Commit ff1facd

Browse files
committed
Skip release build when version already published
- Check for existing GitHub Release before building; emit warning and skip if found - Remove desktop-bump and desktop-publish just recipes (no longer needed) - Remove unused fetch-depth: 0 and env block
1 parent 572705f commit ff1facd

2 files changed

Lines changed: 25 additions & 31 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ concurrency:
1010
group: release-desktop
1111
cancel-in-progress: false
1212

13+
env:
14+
SKIP: "false"
15+
1316
jobs:
1417
release:
1518
runs-on: macos-latest
@@ -20,47 +23,65 @@ jobs:
2023
steps:
2124
- name: Checkout repository
2225
uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
2526

2627
- name: Read version from package.json
2728
id: version
2829
run: |
2930
VERSION=$(node -p "require('./apps/desktop/package.json').version")
3031
echo "version=$VERSION" >> $GITHUB_OUTPUT
3132
33+
- name: Check if version already released
34+
id: check_release
35+
env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
VERSION="${{ steps.version.outputs.version }}"
39+
if gh release view "v$VERSION" --repo "${{ github.repository }}" > /dev/null 2>&1; then
40+
echo "skip=true" >> $GITHUB_OUTPUT
41+
echo "::warning::Version $VERSION already released — skipping build. Bump the version in apps/desktop/package.json to trigger a new release."
42+
else
43+
echo "skip=false" >> $GITHUB_OUTPUT
44+
fi
45+
3246
- name: Install pnpm
47+
if: steps.check_release.outputs.skip != 'true'
3348
uses: pnpm/action-setup@v4
3449

3550
- name: Setup Node.js
51+
if: steps.check_release.outputs.skip != 'true'
3652
uses: actions/setup-node@v4
3753
with:
3854
node-version: 22
3955
cache: pnpm
4056

4157
- name: Install dependencies
58+
if: steps.check_release.outputs.skip != 'true'
4259
run: pnpm install --frozen-lockfile
4360

4461
- name: Typecheck
62+
if: steps.check_release.outputs.skip != 'true'
4563
run: pnpm -C apps/desktop typecheck
4664

4765
- name: Run tests
66+
if: steps.check_release.outputs.skip != 'true'
4867
run: pnpm -C apps/desktop test
4968

5069
- name: Build and publish to GitHub Releases
70+
if: steps.check_release.outputs.skip != 'true'
5171
env:
5272
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5373
run: pnpm -C apps/desktop release
5474

5575
- name: Upload DMG as workflow artifact
76+
if: steps.check_release.outputs.skip != 'true'
5677
uses: actions/upload-artifact@v4
5778
with:
5879
name: ClosedLoop-macOS-${{ steps.version.outputs.version }}
5980
path: apps/desktop/dist-dmg/*.dmg
6081
if-no-files-found: error
6182

6283
- name: Build Slack message
63-
if: success()
84+
if: steps.check_release.outputs.skip != 'true'
6485
id: slack_message
6586
run: |
6687
VERSION="${{ steps.version.outputs.version }}"
@@ -73,7 +94,7 @@ jobs:
7394
echo "EOF" >> $GITHUB_OUTPUT
7495
7596
- name: Notify Slack
76-
if: success()
97+
if: steps.check_release.outputs.skip != 'true'
7798
continue-on-error: true
7899
uses: ./.github/actions/slack-notify
79100
with:

justfile

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,3 @@ desktop-package:
4747
# Start Electron in debug-auth mode (dev-only, enables debug token minting).
4848
desktop-debug-auth:
4949
CL_LOCAL_GATEWAY_DEBUG_AUTH=1 pnpm -C apps/desktop dev
50-
51-
# Bump desktop app version in package.json (include in your PR before merging).
52-
# CI builds and publishes on merge to main when apps/desktop/** changes.
53-
# Usage: just desktop-bump patch (0.1.0 → 0.1.1)
54-
# just desktop-bump minor (0.1.0 → 0.2.0)
55-
# just desktop-bump major (0.1.0 → 1.0.0)
56-
# just desktop-bump 2.0.0 (explicit version)
57-
desktop-bump bump="patch":
58-
#!/usr/bin/env bash
59-
set -euo pipefail
60-
cd apps/desktop
61-
NEW_VERSION=$(npm version "{{bump}}" --no-git-tag-version | tr -d 'v')
62-
echo "Bumped apps/desktop/package.json to v$NEW_VERSION"
63-
echo "Commit this change as part of your PR."
64-
65-
# Build and publish desktop DMG to GitHub Releases locally (bypasses CI).
66-
desktop-publish:
67-
#!/usr/bin/env bash
68-
set -euo pipefail
69-
if [ -z "${GH_TOKEN:-}" ]; then
70-
echo "Error: GH_TOKEN is not set. Export a GitHub PAT with repo/contents:write scope." >&2
71-
exit 1
72-
fi
73-
VERSION=$(node -p "require('./apps/desktop/package.json').version")
74-
pnpm -C apps/desktop release
75-
echo ""
76-
echo "Published v$VERSION to GitHub Releases."

0 commit comments

Comments
 (0)