From bce5f51c0885d1e0a76d5dcf8f782ab8e2b0071e Mon Sep 17 00:00:00 2001 From: Vladimir Drayling Date: Fri, 3 Jul 2026 01:25:54 +0200 Subject: [PATCH] feat(release): wire up nx release for versioning and github releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nx.json: release config (conventionalCommits version bumps, fixed changelog with createRelease: "github", git commit/tag/push) - Add minimal apps/app/package.json and apps/desktop/package.json — nx release's JS version-resolution requires a per-project manifest to fall back to on a project's first release; manifestRootsToUpdate keeps the root package.json (read by electrobun.config.ts) in sync - bun run release (-> nx release --skip-publish) is the one command that bumps version, writes CHANGELOG.md, tags, pushes, and creates the GitHub Release - release.yml: drop generate_release_notes (nx release already wrote proper changelog notes on the release; softprops/action-gh-release updates the existing release with build assets rather than recreating it) - Document the full release sequence in README --- .github/workflows/ci.yml | 19 +++++++++++++++++++ .github/workflows/release.yml | 22 ++++++++++++++++++++++ README.md | 18 ++++++++++++++++++ apps/app/package.json | 4 ++++ apps/desktop/package.json | 4 ++++ electrobun.config.ts | 3 +++ nx.json | 18 ++++++++++++++++++ package.json | 3 ++- 8 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 apps/app/package.json create mode 100644 apps/desktop/package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d25a8df --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: [dev] + pull_request: + branches: [dev] + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - run: bun i --frozen-lockfile + - run: bunx nx run-many -t lint test + - run: bunx nx build desktop --configuration=dev diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..01587fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Release + +on: + push: + tags: ['v*'] + +permissions: + contents: write + +jobs: + release: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - run: bun install --frozen-lockfile + - run: bun run build:stable + - uses: softprops/action-gh-release@v2 + with: + files: artifacts/* diff --git a/README.md b/README.md index e15ec21..6755abf 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,24 @@ bun run dev # runs `nx serve app` (Angular dev server, HMR) + `electrobun dev` The desktop shell (Bun main process, window/menu/tray code) lives in `apps/desktop/src`, separate from the Angular UI in `apps/app` — they're different runtimes with different tsconfigs. Edit `apps/desktop/src/index.ts` and restart `electrobun dev` manually to see changes — do not use `electrobun dev --watch` on Windows, see below. +## Releasing + +```bash +bun run release # every release after the first +bun run release -- --dry-run # preview what it would do, changes nothing +``` + +This runs `nx release --skip-publish`, which bumps the version (from Conventional Commits since the last tag), writes `CHANGELOG.md`, commits, tags (`vX.Y.Z`), pushes, and creates the GitHub Release itself (via your authenticated `gh` CLI or a `GITHUB_TOKEN`/`GH_TOKEN` env var) — no npm/Docker publish step runs. That tag push then triggers [`.github/workflows/release.yml`](.github/workflows/release.yml), which builds the app (`bun run build:stable`) and uploads the `.exe`/`.zip` from `artifacts/` to that same release as downloadable assets. + +For the very first release ever, there's no prior tag to diff from, so add `--first-release`: + +```bash +bun run release -- --first-release --dry-run # preview first +bun run release -- --first-release +``` + +Versions live in three places kept in sync by `nx release` (`nx.json`'s `release.version.manifestRootsToUpdate`): the root `package.json` (which `electrobun.config.ts` reads for `app.version`), and `apps/app/package.json` / `apps/desktop/package.json` (present only so Nx has a manifest to read/write per project — this is an integrated Nx workspace with no other use for per-project `package.json` files). + ### Known issues - **Killing `electrobun dev` leaves orphaned processes on Windows** ([electrobun#168](https://github.com/blackboardsh/electrobun/issues/168)): killing the app only kills the top-level `launcher.exe`; the actual `bun.exe` process and its WebView2 tree survive. Two symptoms: diff --git a/apps/app/package.json b/apps/app/package.json new file mode 100644 index 0000000..3f61577 --- /dev/null +++ b/apps/app/package.json @@ -0,0 +1,4 @@ +{ + "name": "app", + "version": "0.0.1" +} diff --git a/apps/desktop/package.json b/apps/desktop/package.json new file mode 100644 index 0000000..6b9e713 --- /dev/null +++ b/apps/desktop/package.json @@ -0,0 +1,4 @@ +{ + "name": "desktop", + "version": "0.0.1" +} diff --git a/electrobun.config.ts b/electrobun.config.ts index 4d8540f..61d915e 100644 --- a/electrobun.config.ts +++ b/electrobun.config.ts @@ -26,4 +26,7 @@ export default { bundleCEF: false, }, }, + release: { + baseUrl: 'https://github.com/draylegend/letora/releases/latest/download', + }, } satisfies ElectrobunConfig; diff --git a/nx.json b/nx.json index 63fc8fe..335e4bc 100644 --- a/nx.json +++ b/nx.json @@ -39,5 +39,23 @@ "style": "css", "unitTestRunner": "vitest" } + }, + "release": { + "projects": ["app", "desktop"], + "version": { + "conventionalCommits": true, + "manifestRootsToUpdate": ["."] + }, + "changelog": { + "automaticFromRef": true, + "workspaceChangelog": { + "createRelease": "github" + } + }, + "git": { + "commit": true, + "tag": true, + "push": true + } } } diff --git a/package.json b/package.json index 4f91261..65a3274 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "scripts": { "prepare": "husky", "dev": "nx serve desktop", - "build:stable": "nx build desktop" + "build:stable": "nx build desktop", + "release": "nx release --skip-publish" }, "private": true, "dependencies": {