Skip to content

Commit 7c81b18

Browse files
committed
pr clean up
1 parent 6502f99 commit 7c81b18

File tree

7 files changed

+139
-148
lines changed

7 files changed

+139
-148
lines changed

.github/actions/publish-release/action.yml

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,20 @@ runs:
9494
working-directory: '${{ inputs.working-directory }}'
9595
id: 'release_branch'
9696
shell: 'bash'
97+
env:
98+
RELEASE_TAG: '${{ inputs.release-tag }}'
9799
run: |
98-
BRANCH_NAME="release/${{ inputs.release-tag }}"
100+
BRANCH_NAME="release/${RELEASE_TAG}"
99101
git switch -c "${BRANCH_NAME}"
100102
echo "BRANCH_NAME=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
101103
102104
- name: '⬆️ Update package versions'
103105
working-directory: '${{ inputs.working-directory }}'
104106
shell: 'bash'
107+
env:
108+
RELEASE_VERSION: '${{ inputs.release-version }}'
105109
run: |
106-
npm run release:version "${{ inputs.release-version }}"
110+
npm run release:version "${RELEASE_VERSION}"
107111
108112
- name: '💾 Commit and Conditionally Push package versions'
109113
working-directory: '${{ inputs.working-directory }}'
@@ -151,10 +155,11 @@ runs:
151155
working-directory: '${{ inputs.working-directory }}'
152156
env:
153157
NODE_AUTH_TOKEN: '${{ inputs.github-token }}'
158+
DRY_RUN: '${{ inputs.dry-run }}'
154159
shell: 'bash'
155160
run: |
156161
npm publish \
157-
--dry-run="${{ inputs.dry-run }}" \
162+
--dry-run="${DRY_RUN}" \
158163
--no-tag
159164
160165
- name: 'Configure npm for publishing to npm'
@@ -181,22 +186,29 @@ runs:
181186
working-directory: '${{ inputs.working-directory }}'
182187
env:
183188
NODE_AUTH_TOKEN: '${{ steps.core-token.outputs.auth-token }}'
189+
DRY_RUN: '${{ inputs.dry-run }}'
190+
CORE_PACKAGE_NAME: '${{ inputs.core-package-name }}'
184191
shell: 'bash'
185192
run: |
186193
npm publish \
187-
--dry-run="${{ inputs.dry-run }}" \
188-
--workspace="${{ inputs.core-package-name }}" \
194+
--dry-run="${DRY_RUN}" \
195+
--workspace="${CORE_PACKAGE_NAME}" \
189196
--no-tag
190-
npm dist-tag rm ${{ inputs.core-package-name }} false --silent
197+
npm dist-tag rm ${CORE_PACKAGE_NAME} false --silent
191198
192199
- name: '🔗 Install latest core package'
193-
if: "${{ inputs.dry-run != 'true' && inputs.use-bundle-release == 'false' }}"
200+
if: "${{ inputs.dry-run == 'false' && inputs.use-bundle-release == 'false' }}"
194201
working-directory: '${{ inputs.working-directory }}'
195202
shell: 'bash'
203+
env:
204+
CORE_PACKAGE_NAME: '${{ inputs.core-package-name }}'
205+
RELEASE_VERSION: '${{ inputs.release-version }}'
206+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
207+
A2A_PACKAGE_NAME: '${{ inputs.a2a-package-name }}'
196208
run: |
197-
npm install "${{ inputs.core-package-name }}@${{ inputs.release-version }}" \
198-
--workspace="${{ inputs.cli-package-name }}" \
199-
--workspace="${{ inputs.a2a-package-name }}" \
209+
npm install "${CORE_PACKAGE_NAME}@${RELEASE_VERSION}" \
210+
--workspace="${CLI_PACKAGE_NAME}" \
211+
--workspace="${A2A_PACKAGE_NAME}" \
200212
--save-exact
201213
202214
- name: 'Get CLI Token'
@@ -215,12 +227,14 @@ runs:
215227
working-directory: '${{ inputs.working-directory }}'
216228
env:
217229
NODE_AUTH_TOKEN: '${{ steps.cli-token.outputs.auth-token }}'
230+
DRY_RUN: '${{ inputs.dry-run }}'
231+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
218232
shell: 'bash'
219233
run: |
220234
npm publish \
221-
--dry-run="${{ inputs.dry-run }}" \
235+
--dry-run="${DRY_RUN}" \
222236
--no-tag
223-
npm dist-tag rm ${{ inputs.cli-package-name }} false --silent
237+
npm dist-tag rm ${CLI_PACKAGE_NAME} false --silent
224238
225239
- name: 'Get a2a-server Token'
226240
if: "${{ inputs.use-bundle-release == 'false' }}"
@@ -238,17 +252,19 @@ runs:
238252
working-directory: '${{ inputs.working-directory }}'
239253
env:
240254
NODE_AUTH_TOKEN: '${{ steps.a2a-token.outputs.auth-token }}'
255+
DRY_RUN: '${{ inputs.dry-run }}'
256+
A2A_PACKAGE_NAME: '${{ inputs.a2a-package-name }}'
241257
shell: 'bash'
242258
# Tag staging for initial release
243259
run: |
244260
npm publish \
245-
--dry-run="${{ inputs.dry-run }}" \
246-
--workspace="${{ inputs.a2a-package-name }}" \
261+
--dry-run="${DRY_RUN}" \
262+
--workspace="${A2A_PACKAGE_NAME}" \
247263
--no-tag
248-
npm dist-tag rm ${{ inputs.a2a-package-name }} false --silent
264+
npm dist-tag rm ${A2A_PACKAGE_NAME} false --silent
249265
250266
- name: '🔬 Verify NPM release by version'
251-
if: "${{ inputs.dry-run != 'true' && inputs.force-skip-tests != 'true' && inputs.use-bundle-release == 'false' }}"
267+
if: "${{ inputs.dry-run == 'false' && inputs.force-skip-tests == 'false' && inputs.use-bundle-release == 'false' }}"
252268
uses: './.github/actions/verify-release'
253269
with:
254270
npm-package: '${{ inputs.cli-package-name }}@${{ inputs.release-version }}'
@@ -275,31 +291,39 @@ runs:
275291
working-directory: '${{ inputs.working-directory }}'
276292

277293
- name: '🔬 Verify Bundled NPM release by version'
278-
if: "${{ inputs.dry-run != 'true' && inputs.force-skip-tests != 'true' && inputs.use-bundle-release == 'true' }}"
294+
if: "${{ inputs.dry-run == 'false' && inputs.force-skip-tests == 'false' && inputs.use-bundle-release == 'true' }}"
279295
working-directory: '${{ inputs.working-directory }}'
280296
shell: 'bash'
297+
env:
298+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
299+
RELEASE_VERSION: '${{ inputs.release-version }}'
281300
run: |
282-
npx -y ${{ inputs.cli-package-name }}@${{ inputs.release-version }} --version
301+
npx -y ${CLI_PACKAGE_NAME}@${RELEASE_VERSION} --version
283302
284303
- name: '🎉 Create GitHub Release'
285304
working-directory: '${{ inputs.working-directory }}'
286-
if: "${{ inputs.dry-run != 'true' && inputs.skip-github-release != 'true' && inputs.npm-tag != 'dev' && inputs.npm-registry-url != 'https://npm.pkg.github.com/' }}"
305+
if: "${{ inputs.dry-run == 'false' && inputs.skip-github-release == 'false' && inputs.npm-tag != 'dev' && inputs.npm-registry-url != 'https://npm.pkg.github.com/' }}"
287306
env:
288307
GITHUB_TOKEN: '${{ inputs.github-token }}'
308+
RELEASE_TAG: '${{ inputs.release-tag }}'
309+
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
310+
PREVIOUS_TAG: '${{ inputs.previous-tag }}'
289311
shell: 'bash'
290312
run: |
291-
gh release create "${{ inputs.release-tag }}" \
313+
gh release create "${RELEASE_TAG}" \
292314
bundle/gemini.js \
293-
--target "${{ steps.release_branch.outputs.BRANCH_NAME }}" \
294-
--title "Release ${{ inputs.release-tag }}" \
295-
--notes-start-tag "${{ inputs.previous-tag }}" \
315+
--target "${BRANCH_NAME}" \
316+
--title "Release ${RELEASE_TAG}" \
317+
--notes-start-tag "${PREVIOUS_TAG}" \
296318
--generate-notes
297319
298320
- name: '🧹 Clean up release branch'
299321
working-directory: '${{ inputs.working-directory }}'
300-
if: "${{ inputs.dry-run != 'true' && inputs.skip-branch-cleanup != 'true' }}"
322+
if: "${{ inputs.dry-run == 'false' && inputs.skip-branch-cleanup == 'false' }}"
301323
continue-on-error: true
302324
shell: 'bash'
325+
env:
326+
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
303327
run: |
304-
echo "Cleaning up release branch ${{ steps.release_branch.outputs.BRANCH_NAME }}..."
305-
git push origin --delete "${{ steps.release_branch.outputs.BRANCH_NAME }}"
328+
echo "Cleaning up release branch ${BRANCH_NAME}..."
329+
git push origin --delete "${BRANCH_NAME}"

.github/workflows/bundle-size.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ jobs:
3030
node-version-file: '.nvmrc'
3131
cache: 'npm'
3232

33-
- name: 'Configure npm for GitHub Packages'
34-
run: |
35-
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
36-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
33+
- name: 'Setup NPMRC'
34+
uses: './.github/actions/setup-npmrc'
35+
with:
36+
github-token: '${{ secrets.GITHUB_TOKEN }}'
3737

3838
- name: 'Install dependencies'
39-
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
39+
env:
40+
VERSION: '${{ inputs.version }}'
41+
run: 'npm install @google-gemini/gemini-cli@${{ env.VERSION }}'
4042

4143
- name: 'Check Bundle Size'
4244
uses: 'preactjs/compressed-size-action@946a292cd35bd1088e0d7eb92b69d1a8d5b5d76a'

.github/workflows/e2e.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
e2e_linux:
2222
name: 'E2E Test (Linux) - ${{ matrix.sandbox }}'
2323
if: |
24-
(github.event_name == 'push' ||
24+
github.event_name == 'push' ||
2525
github.event_name == 'merge_group' ||
2626
github.event_name == 'workflow_dispatch' ||
27-
(github.event.pull_request.head.repo.full_name == github.repository) ||
28-
(github.event.label.name == 'maintainer:e2e:ok'))
27+
github.event.pull_request.head.repo.full_name == github.repository ||
28+
github.event.label.name == 'maintainer:e2e:ok'
2929
runs-on: 'gemini-cli-ubuntu-16-core'
3030
strategy:
3131
fail-fast: false
@@ -65,7 +65,10 @@ jobs:
6565
run: 'docker pull ${{ inputs.image-uri }}'
6666

6767
- name: 'Install dependencies'
68-
run: 'npm install ${{ inputs.cli-package-name }}@${{ inputs.version }}'
68+
env:
69+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
70+
VERSION: '${{ inputs.version }}'
71+
run: 'npm install ${{ env.CLI_PACKAGE_NAME }}@${{ env.VERSION }}'
6972

7073
- name: 'Run E2E tests'
7174
env:
@@ -85,11 +88,11 @@ jobs:
8588
e2e_mac:
8689
name: 'E2E Test (macOS)'
8790
if: |
88-
(github.event_name == 'push' ||
91+
github.event_name == 'push' ||
8992
github.event_name == 'merge_group' ||
9093
github.event_name == 'workflow_dispatch' ||
91-
(github.event.pull_request.head.repo.full_name == github.repository) ||
92-
(github.event.label.name == 'maintainer:e2e:ok'))
94+
github.event.pull_request.head.repo.full_name == github.repository ||
95+
github.event.label.name == 'maintainer:e2e:ok'
9396
runs-on: 'macos-latest'
9497
steps:
9598
- name: 'Checkout (fork)'
@@ -116,7 +119,10 @@ jobs:
116119
github-token: '${{ secrets.GITHUB_TOKEN }}'
117120

118121
- name: 'Install dependencies'
119-
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
122+
env:
123+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
124+
VERSION: '${{ inputs.version }}'
125+
run: 'npm install ${{ env.CLI_PACKAGE_NAME }}@${{ env.VERSION }}'
120126

121127
- name: 'Fix rollup optional dependencies on macOS'
122128
if: "runner.os == 'macOS'"
@@ -135,11 +141,11 @@ jobs:
135141
e2e_windows:
136142
name: 'Slow E2E - Win'
137143
if: |
138-
(github.event_name == 'push' ||
144+
github.event_name == 'push' ||
139145
github.event_name == 'merge_group' ||
140146
github.event_name == 'workflow_dispatch' ||
141-
(github.event.pull_request.head.repo.full_name == github.repository) ||
142-
(github.event.label.name == 'maintainer:e2e:ok'))
147+
github.event.pull_request.head.repo.full_name == github.repository ||
148+
github.event.label.name == 'maintainer:e2e:ok'
143149
runs-on: 'gemini-cli-windows-16-core'
144150
continue-on-error: true
145151

@@ -187,7 +193,10 @@ jobs:
187193
github-token: '${{ secrets.GITHUB_TOKEN }}'
188194

189195
- name: 'Install dependencies'
190-
run: 'npm install ${{ inputs.cli-package-name }}@${{ inputs.version }}'
196+
env:
197+
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
198+
VERSION: '${{ inputs.version }}'
199+
run: 'npm install ${{ env.CLI_PACKAGE_NAME }}@${{ env.VERSION }}'
191200
shell: 'pwsh'
192201

193202
- name: 'Run E2E tests'
@@ -210,8 +219,8 @@ jobs:
210219
github.event_name == 'push' ||
211220
github.event_name == 'merge_group' ||
212221
github.event_name == 'workflow_dispatch' ||
213-
(github.event.pull_request.head.repo.full_name == github.repository) ||
214-
(github.event.label.name == 'maintainer:e2e:ok')
222+
github.event.pull_request.head.repo.full_name == github.repository ||
223+
github.event.label.name == 'maintainer:e2e:ok'
215224
)
216225
needs:
217226
- 'e2e_linux'

.github/workflows/orchestrator.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@ jobs:
4646
npm-registry-url: '${{ steps.get-vars.outputs.npm-registry-url }}'
4747
steps:
4848
- id: 'get-vars'
49+
env:
50+
CLI_PACKAGE_NAME: '${{ vars.CLI_PACKAGE_NAME }}'
51+
NPM_REGISTRY_SCOPE: '${{ vars.NPM_REGISTRY_SCOPE }}'
52+
NPM_REGISTRY_URL: '${{ vars.NPM_REGISTRY_URL }}'
4953
run: |
50-
echo 'cli-package-name=${{ vars.CLI_PACKAGE_NAME }}' >> "$GITHUB_OUTPUT"
51-
echo 'npm-registry-scope=${{ vars.NPM_REGISTRY_SCOPE }}' >> "$GITHUB_OUTPUT"
52-
echo 'npm-registry-url=${{ vars.NPM_REGISTRY_URL }}' >> "$GITHUB_OUTPUT"
54+
echo "cli-package-name=${CLI_PACKAGE_NAME}" >> "$GITHUB_OUTPUT"
55+
echo "npm-registry-scope=${NPM_REGISTRY_SCOPE}" >> "$GITHUB_OUTPUT"
56+
echo "npm-registry-url=${NPM_REGISTRY_URL}" >> "$GITHUB_OUTPUT"
5357
5458
build-and-publish:
5559
name: 'Build and Publish CI Bundle'

CONTRIBUTING.md

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,27 @@ npm run lint
279279
- **Imports:** Pay special attention to import paths. The project uses ESLint to
280280
enforce restrictions on relative imports between packages.
281281

282-
### Working with Pre-Release Versions (Development)
282+
### Setting Up Your NPM Environment
283283

284-
This project uses **GitHub Packages** to host development and pre-release
285-
versions of the CLI. To install these versions, you must configure your
286-
user-level `~/.npmrc` file to authenticate with the GitHub registry.
284+
**Note:** The following instructions are intended for contributors who need to
285+
work with pre-release versions hosted on the private GitHub Packages registry.
286+
General contributors who only use the public `npmjs.org` registry may not need
287+
to perform this setup.
287288

288-
We have created a script to automate this process for you.
289+
This project uses a hybrid registry model:
290+
- Production packages (e.g., `@google/gemini-cli`) are published to `npmjs.org`.
291+
- Pre-release and development packages (e.g., `@google-gemini/gemini-cli`) are
292+
published to **GitHub Packages**.
289293

290-
#### Setting Up Your Environment for Development (Recommended)
294+
To work with both registries, you need to configure your user-level `~/.npmrc`
295+
file to authenticate with GitHub Packages. We have a script to automate this.
291296

292-
To automatically configure your environment to use the GitHub Packages registry,
293-
run the following command:
297+
#### Configure Your `~/.npmrc` File
298+
299+
Run the following command to automatically configure your `~/.npmrc` file:
294300

295301
```bash
296-
npm run use-dev
302+
npm run setup-npmrc
297303
```
298304

299305
This command will:
@@ -302,23 +308,12 @@ This command will:
302308
installed and that you are logged in.
303309
2. **Back up** your existing `~/.npmrc` to `~/.npmrc.bak` if a backup doesn't
304310
already exist.
305-
3. **Automatically add** the necessary configuration to your `~/.npmrc` file.
306-
307-
This setup is required for installing pre-release packages with the
308-
`@google-gemini` scope, both locally within a project and globally (e.g.,
309-
`npm install -g @google-gemini/gemini-cli@<version>`).
310-
311-
#### Switching Back to the Production Registry
312-
313-
To automatically remove the development configuration and revert to the public
314-
npm registry (`npmjs.org`), you can run:
315-
316-
```bash
317-
npm run use-prod
318-
```
311+
3. **Overwrite** your `~/.npmrc` with the correct configuration to pull
312+
packages from both `npmjs.org` and `npm.pkg.github.com` based on their scope.
319313

320-
This command will safely remove the lines added by the `use-dev` script from
321-
your `~/.npmrc` file.
314+
After running this, you can install packages from both registries without any
315+
further configuration. If your GitHub token expires, you can simply run the
316+
command again to update it.
322317

323318
### Project Structure
324319

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@
6363
"check:lockfile": "node scripts/check-lockfile.js",
6464
"clean": "node scripts/clean.js",
6565
"pre-commit": "node scripts/pre-commit.js",
66-
"use-dev": "node scripts/configure-registry.js dev",
67-
"use-prod": "node scripts/configure-registry.js prod"
66+
"setup-npmrc": "node scripts/configure-registry.js"
6867
},
6968
"overrides": {
7069
"wrap-ansi": "9.0.2",

0 commit comments

Comments
 (0)