mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-23 17:56:55 -07:00
feat: address PR feedback
- Use reusable npmrc action in workflows - Make package name dynamic in e2e tests - Add rationale for configure-registry script - Force orchestrator to run in dev environment
This commit is contained in:
@@ -33,10 +33,10 @@ jobs:
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm ci'
|
||||
|
||||
- name: 'Configure npm for GitHub Packages'
|
||||
run: |
|
||||
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||
- name: 'Setup NPMRC'
|
||||
uses: ./.github/actions/setup-npmrc
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'Bundle'
|
||||
run: 'npm run bundle'
|
||||
|
||||
+19
-19
@@ -9,6 +9,10 @@ on:
|
||||
description: 'The version of the published package'
|
||||
required: true
|
||||
type: 'string'
|
||||
cli-package-name:
|
||||
description: 'The name of the CLI package to install'
|
||||
required: true
|
||||
type: 'string'
|
||||
secrets:
|
||||
GEMINI_API_KEY:
|
||||
required: true
|
||||
@@ -31,7 +35,6 @@ jobs:
|
||||
- 'sandbox:docker'
|
||||
node-version:
|
||||
- '20.x'
|
||||
|
||||
steps:
|
||||
- name: 'Checkout (fork)'
|
||||
uses: 'actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955' # ratchet:actions/checkout@v5
|
||||
@@ -46,15 +49,13 @@ jobs:
|
||||
with:
|
||||
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
|
||||
|
||||
- name: 'Configure npm for GitHub Packages'
|
||||
run: |
|
||||
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||
- name: 'Setup NPMRC'
|
||||
uses: ./.github/actions/setup-npmrc
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
|
||||
|
||||
- name: 'Set up Docker'
|
||||
run: 'npm install ${{ inputs.cli-package-name }}@${{ inputs.version }}'
|
||||
if: "matrix.sandbox == 'sandbox:docker'"
|
||||
uses: 'docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435' # ratchet:docker/setup-buildx-action@v3
|
||||
|
||||
@@ -100,10 +101,10 @@ jobs:
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: 'Configure npm for GitHub Packages'
|
||||
run: |
|
||||
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||
- name: 'Setup NPMRC'
|
||||
uses: ./.github/actions/setup-npmrc
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
|
||||
@@ -171,14 +172,13 @@ jobs:
|
||||
npm config set registry https://registry.npmjs.org/
|
||||
shell: 'pwsh'
|
||||
|
||||
- name: 'Configure npm for GitHub Packages'
|
||||
run: |
|
||||
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||
shell: 'pwsh'
|
||||
- name: 'Setup NPMRC'
|
||||
uses: ./.github/actions/setup-npmrc
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
|
||||
run: 'npm install ${{ inputs.cli-package-name }}@${{ inputs.version }}'
|
||||
shell: 'pwsh'
|
||||
|
||||
- name: 'Run E2E tests'
|
||||
@@ -216,4 +216,4 @@ jobs:
|
||||
echo "One or more E2E jobs failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "All required E2E jobs passed!"
|
||||
echo "All required E2E jobs passed!"
|
||||
@@ -47,8 +47,10 @@ jobs:
|
||||
name: 'E2E Checks'
|
||||
needs: 'build-and-publish'
|
||||
uses: './.github/workflows/e2e.yml'
|
||||
environment: dev
|
||||
with:
|
||||
version: '${{ needs.build-and-publish.outputs.version }}'
|
||||
cli-package-name: '${{ vars.CLI_PACKAGE_NAME }}'
|
||||
secrets:
|
||||
GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}'
|
||||
|
||||
|
||||
@@ -4,6 +4,22 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview This script automates the configuration of the user's
|
||||
* global .npmrc file to switch between the production npm registry (npmjs.org)
|
||||
* and the development registry (GitHub Packages).
|
||||
*
|
||||
* Rationale:
|
||||
* While a developer could manually configure their .npmrc file, this script
|
||||
* provides a consistent, automated, and less error-prone way to manage
|
||||
* registry configurations. It simplifies the process of switching between
|
||||
* consuming production packages and pre-release packages for development
|
||||
* and testing, which is a common workflow in this project.
|
||||
*
|
||||
* The script also handles backing up and restoring the user's existing
|
||||
* .npmrc file, preventing accidental data loss.
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
|
||||
Reference in New Issue
Block a user