You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/releases.md
+46-99Lines changed: 46 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,9 +70,10 @@ For situations requiring a release outside of the regular nightly and weekly pro
70
70
4. Fill in the required inputs:
71
71
-**Version**: The exact version to release (e.g., `v0.6.1`). This must be a valid semantic version with a `v` prefix.
72
72
-**Ref**: The branch, tag, or full commit SHA to release from.
73
-
-**NPM Channel**: The npm tag to publish with. Select `stable` for a general release, `preview`for a pre-release, or `none` to skip publishing to npm entirely.
73
+
-**NPM Channel**: The npm channel to publish to. The options are `preview`, `nightly`, `latest` (for stable releases), and `dev`. The default is `dev`.
74
74
-**Dry Run**: Leave as `true` to run all steps without publishing, or set to `false` to perform a live release.
75
75
-**Force Skip Tests**: Set to `true` to skip the test suite. This is not recommended for production releases.
76
+
-**Skip GitHub Release**: Set to `true` to skip creating a GitHub release and create an npm release only.
76
77
5. Click **Run workflow**.
77
78
78
79
The workflow will then proceed to test (if not skipped), build, and publish the release. If the workflow fails during a non-dry run, it will automatically create a GitHub issue with the failure details.
@@ -295,108 +296,54 @@ By performing a dry run, you can be confident that your changes to the packaging
295
296
296
297
## Release Deep Dive
297
298
298
-
The main goal of the release process is to take the source code from the packages/ directory, build it, and assemble a
299
-
clean, self-contained package in a temporary `bundle` directory at the root of the project. This `bundle` directory is what
300
-
actually gets published to NPM.
299
+
The release process creates two distinct types of artifacts for different distribution channels: standard packages for the NPM registry and a single, self-contained executable for GitHub Releases.
301
300
302
301
Here are the key stages:
303
302
304
-
Stage 1: Pre-Release Sanity Checks and Versioning
305
-
306
-
- What happens: Before any files are moved, the process ensures the project is in a good state. This involves running tests,
307
-
linting, and type-checking (npm run preflight). The version number in the root package.json and packages/cli/package.json
308
-
is updated to the new release version.
309
-
- Why: This guarantees that only high-quality, working code is released. Versioning is the first step to signify a new
310
-
release.
311
-
312
-
Stage 2: Building the Source Code
313
-
314
-
- What happens: The TypeScript source code in packages/core/src and packages/cli/src is compiled into JavaScript.
315
-
- File movement:
316
-
- packages/core/src/\*_/_.ts -> compiled to -> packages/core/dist/
317
-
- packages/cli/src/\*_/_.ts -> compiled to -> packages/cli/dist/
318
-
- Why: The TypeScript code written during development needs to be converted into plain JavaScript that can be run by
319
-
Node.js. The core package is built first as the cli package depends on it.
320
-
321
-
Stage 3: Assembling the Final Publishable Package
322
-
323
-
This is the most critical stage where files are moved and transformed into their final state for publishing. A temporary
324
-
`bundle` folder is created at the project root to house the final package contents.
325
-
326
-
1. The `package.json` is Transformed:
327
-
- What happens: The package.json from packages/cli/ is read, modified, and written into the root `bundle`/ directory.
**Stage 1: Pre-Release Sanity Checks and Versioning**
304
+
305
+
-**What happens:** Before any files are moved, the process ensures the project is in a good state. This involves running tests, linting, and type-checking (`npm run preflight`). The version number in the root `package.json` and `packages/cli/package.json` is updated to the new release version.
306
+
307
+
**Stage 2: Building the Source Code for NPM**
308
+
309
+
-**What happens:** The TypeScript source code in `packages/core/src` and `packages/cli/src` is compiled into standard JavaScript.
310
+
-**File movement:**
311
+
-`packages/core/src/**/*.ts` -> compiled to -> `packages/core/dist/`
312
+
-`packages/cli/src/**/*.ts` -> compiled to -> `packages/cli/dist/`
313
+
-**Why:** The TypeScript code written during development needs to be converted into plain JavaScript that can be run by Node.js. The `core` package is built first as the `cli` package depends on it.
314
+
315
+
**Stage 3: Publishing Standard Packages to NPM**
316
+
317
+
-**What happens:** The `npm publish` command is run for the `@google/gemini-cli-core` and `@google/gemini-cli` packages.
318
+
-**Why:** This publishes them as standard Node.js packages. Users installing via `npm install -g @google/gemini-cli` will download these packages, and `npm` will handle installing the `@google/gemini-cli-core` dependency automatically. The code in these packages is not bundled into a single file.
319
+
320
+
**Stage 4: Assembling and Creating the GitHub Release Asset**
321
+
322
+
This stage happens _after_ the NPM publish and creates the single-file executable that enables `npx` usage directly from the GitHub repository.
323
+
324
+
1.**The JavaScript Bundle is Created:**
325
+
-**What happens:** The built JavaScript from both `packages/core/dist` and `packages/cli/dist`, along with all third-party JavaScript dependencies, are bundled by `esbuild` into a single, executable JavaScript file (e.g., `gemini.js`). The `node-pty` library is excluded from this bundle as it contains native binaries.
326
+
-**Why:** This creates a single, optimized file that contains all the necessary application code. It simplifies execution for users who want to run the CLI without a full `npm install`, as all dependencies (including the `core` package) are included directly.
327
+
328
+
2.**The `bundle` Directory is Assembled:**
329
+
-**What happens:** A temporary `bundle` folder is created at the project root. The single `gemini.js` executable is placed inside it, along with other essential files.
-**Why:** This creates a clean, self-contained directory with everything needed to run the CLI and understand its license and usage.
336
+
337
+
3.**The GitHub Release is Created:**
338
+
-**What happens:** The contents of the `bundle` directory, including the `gemini.js` executable, are attached as assets to a new GitHub Release.
339
+
-**Why:** This makes the single-file version of the CLI available for direct download and enables the `npx https://github.com/google-gemini/gemini-cli` command, which downloads and runs this specific bundled asset.
340
+
341
+
**Summary of Artifacts**
342
+
343
+
-**NPM:** Publishes standard, un-bundled Node.js packages. The primary artifact is the code in `packages/cli/dist`, which depends on `@google/gemini-cli-core`.
344
+
-**GitHub Release:** Publishes a single, bundled `gemini.js` file that contains all dependencies, for easy execution via `npx`.
397
345
398
-
This process ensures that the final published artifact is a purpose-built, clean, and efficient representation of the
399
-
project, rather than a direct copy of the development workspace.
346
+
This dual-artifact process ensures that both traditional `npm` users and those who prefer the convenience of `npx` have an optimized experience.
0 commit comments