feat: add release trigger configuration (#1697)

This commit is contained in:
Brandon Keiji 2025-06-26 01:54:58 +00:00 committed by GitHub
parent bb797ded7d
commit a8763abfb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 167 additions and 58 deletions

View File

@ -1,47 +0,0 @@
steps:
# Step 1: Install root dependencies (includes workspaces)
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
entrypoint: 'npm'
args: ['install']
# Step 2: Update version in root package.json
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
entrypoint: 'bash'
args:
- -c # Use bash -c to allow for command substitution and string manipulation
- |
current_version=$(npm pkg get version | sed 's/"//g')
new_version="$${current_version}-$SHORT_SHA.$_REVISION"
npm pkg set "version=$${new_version}"
echo "Set root package.json version to: $${new_version}"
# Step 3: Run prerelease:dev to update workspace versions and dependencies
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
entrypoint: 'npm'
args: ['run', 'prerelease:dev'] # This will run prerelease:version and prerelease:deps
# Step 4: Authenticate for Docker and NPM
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
entrypoint: 'npm'
args: ['run', 'auth']
# Step 5: Run the master release script
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
entrypoint: 'npm'
args: ['run', 'publish:release']
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
- 'NPM_PUBLISH_TAG=$_NPM_PUBLISH_TAG'
options:
defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET
dynamicSubstitutions: true
substitutions:
_REVISION: '0'
_SANDBOX_IMAGE_REGISTRY: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-cli'
_SANDBOX_IMAGE_NAME: 'sandbox-ci'
_NPM_PUBLISH_TAG: 'head'
_CONTAINER_TOOL: 'docker'

144
.gcp/release.yaml Normal file
View File

@ -0,0 +1,144 @@
steps:
# Step 1: Install root dependencies (includes workspaces)
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Install Dependencies'
entrypoint: 'npm'
args: ['install']
# Step 2: Update version in root package.json
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Set version in workspace root'
entrypoint: 'bash'
args:
- -c # Use bash -c to allow for command substitution and string manipulation
- |
current_version=$(npm pkg get version | sed 's/"//g')
if [ "$_OFFICIAL_RELEASE" = "true" ]; then
new_version="$current_version"
else
new_version="${current_version}-rc.$_REVISION"
fi
npm pkg set "version=${new_version}"
echo "Set root package.json version to: ${new_version}"
# Step 3: Binds the package versions to the version in the repo root's package.json
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Bind package versions to workspace root'
entrypoint: 'npm'
args: ['run', 'prerelease:dev'] # This will run prerelease:version and prerelease:deps
# Step 4: Authenticate for Docker (so we can push images to the artifact registry)
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Authenticate docker'
entrypoint: 'npm'
args: ['run', 'auth']
# Step 5: Build workspace packages
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Build packages'
entrypoint: 'npm'
args: ['run', 'build:packages']
# Step 6: Prepare CLI package.json for publishing
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Prepare @google/gemini-cli package.json and readme'
entrypoint: 'npm'
args: ['run', 'prepare:cli-packagejson']
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
# Step 7: Build sandbox container image
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Build sandbox Docker image'
entrypoint: 'npm'
args: ['run', 'build:sandbox:fast']
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
# Step 8: Publish sandbox container image
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Publish sandbox Docker image'
entrypoint: 'npm'
args: ['run', 'publish:sandbox']
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
# Pre-Step 9: authenticate to our intermediate npm registry
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Setup @google/gemini-cli-core auth token for publishing'
entrypoint: 'bash'
args:
- -c
- |
echo "//wombat-dressing-room.appspot.com/:_authToken=$$CORE_PACKAGE_PUBLISH_TOKEN" > $$HOME/.npmrc
secretEnv: ['CORE_PACKAGE_PUBLISH_TOKEN']
# Step 9: Publish @google/gemini-cli-core to NPM
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Publish @google/gemini-cli-core package'
entrypoint: 'bash'
args:
- -c
- |
if [ "$_OFFICIAL_RELEASE" = "true" ]; then
npm publish --workspace=@google/gemini-cli-core --tag=latest
else
npm publish --workspace=@google/gemini-cli-core --tag=rc
fi
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
# Pre-Step 10: authenticate to our intermediate npm registry
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Setup @google/gemini-cli auth token for publishing'
entrypoint: 'bash'
args:
- -c
- |
echo "//wombat-dressing-room.appspot.com/:_authToken=$$CLI_PACKAGE_PUBLISH_TOKEN" > $$HOME/.npmrc
secretEnv: ['CLI_PACKAGE_PUBLISH_TOKEN']
# Step 10: Publish @google/gemini-cli to NPM
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Publish @google/gemini-cli package'
entrypoint: 'bash'
args:
- -c
- |
if [ "$_OFFICIAL_RELEASE" = "true" ]; then
npm publish --workspace=@google/gemini-cli --tag=latest
else
npm publish --workspace=@google/gemini-cli --tag=rc
fi
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'SANDBOX_IMAGE_REGISTRY=$_SANDBOX_IMAGE_REGISTRY'
- 'SANDBOX_IMAGE_NAME=$_SANDBOX_IMAGE_NAME'
options:
defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET
dynamicSubstitutions: true
availableSecrets:
secretManager:
- versionName: ${_CLI_PACKAGE_WOMBAT_TOKEN_RESOURCE_NAME}
env: 'CLI_PACKAGE_PUBLISH_TOKEN'
- versionName: ${_CORE_PACKAGE_WOMBAT_TOKEN_RESOURCE_NAME}
env: 'CORE_PACKAGE_PUBLISH_TOKEN'
substitutions:
_REVISION: '0'
_OFFICIAL_RELEASE: 'false'
_CONTAINER_TOOL: 'docker'
_SANDBOX_IMAGE_REGISTRY: ''
_SANDBOX_IMAGE_NAME: ''
_CLI_PACKAGE_WOMBAT_TOKEN_RESOURCE_NAME: ''
_CORE_PACKAGE_WOMBAT_TOKEN_RESOURCE_NAME: ''

10
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@google/gemini-cli", "name": "@google/gemini-cli",
"version": "0.1.1", "version": "0.1.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@google/gemini-cli", "name": "@google/gemini-cli",
"version": "0.1.1", "version": "0.1.4",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@ -11671,9 +11671,9 @@
}, },
"packages/cli": { "packages/cli": {
"name": "@google/gemini-cli", "name": "@google/gemini-cli",
"version": "0.1.1", "version": "0.1.4",
"dependencies": { "dependencies": {
"@google/gemini-cli-core": "0.1.1", "@google/gemini-cli-core": "*",
"@types/update-notifier": "^6.0.8", "@types/update-notifier": "^6.0.8",
"command-exists": "^1.2.9", "command-exists": "^1.2.9",
"diff": "^7.0.0", "diff": "^7.0.0",
@ -11745,7 +11745,7 @@
}, },
"packages/core": { "packages/core": {
"name": "@google/gemini-cli-core", "name": "@google/gemini-cli-core",
"version": "0.1.1", "version": "0.1.4",
"dependencies": { "dependencies": {
"@google/genai": "^1.4.0", "@google/genai": "^1.4.0",
"@modelcontextprotocol/sdk": "^1.11.0", "@modelcontextprotocol/sdk": "^1.11.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@google/gemini-cli", "name": "@google/gemini-cli",
"version": "0.1.1", "version": "0.1.4",
"type": "module", "type": "module",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
@ -39,11 +39,11 @@
"build:cli": "npm run build --workspace packages/cli", "build:cli": "npm run build --workspace packages/cli",
"build:core": "npm run build --workspace packages/core", "build:core": "npm run build --workspace packages/core",
"build:packages": "npm run build:core && npm run build:cli", "build:packages": "npm run build:core && npm run build:cli",
"build:docker": "node scripts/build_sandbox.js -s", "build:sandbox:fast": "node scripts/build_sandbox.js --skip-npm-install-build",
"prepare:cli-packagejson": "node scripts/prepare-cli-packagejson.js", "prepare:cli-packagejson": "node scripts/prepare-cli-packagejson.js",
"publish:sandbox": "node scripts/publish-sandbox.js", "publish:sandbox": "node scripts/publish-sandbox.js",
"publish:npm": "npm publish --workspaces ${NPM_PUBLISH_TAG:+--tag=$NPM_PUBLISH_TAG} ${NPM_DRY_RUN:+--dry-run}", "publish:npm": "npm publish --workspaces ${NPM_PUBLISH_TAG:+--tag=$NPM_PUBLISH_TAG} ${NPM_DRY_RUN:+--dry-run}",
"publish:release": "npm run build:packages && npm run prepare:cli-packagejson && npm run build:docker && npm run publish:sandbox && npm run publish:npm", "publish:release": "npm run build:packages && npm run prepare:cli-packagejson && npm run build:sandbox:fast && npm run publish:sandbox && npm run publish:npm",
"telemetry": "node scripts/telemetry.js", "telemetry": "node scripts/telemetry.js",
"start:gcp": "concurrently --raw --kill-others \"npm run telemetry -- --target=gcp\" \"npm start\"" "start:gcp": "concurrently --raw --kill-others \"npm run telemetry -- --target=gcp\" \"npm start\""
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "@google/gemini-cli", "name": "@google/gemini-cli",
"version": "0.1.1", "version": "0.1.4",
"description": "Gemini CLI", "description": "Gemini CLI",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
@ -28,7 +28,7 @@
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1" "sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.1.1"
}, },
"dependencies": { "dependencies": {
"@google/gemini-cli-core": "0.1.1", "@google/gemini-cli-core": "*",
"@types/update-notifier": "^6.0.8", "@types/update-notifier": "^6.0.8",
"command-exists": "^1.2.9", "command-exists": "^1.2.9",
"diff": "^7.0.0", "diff": "^7.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@google/gemini-cli-core", "name": "@google/gemini-cli-core",
"version": "0.1.1", "version": "0.1.4",
"description": "Gemini CLI Server", "description": "Gemini CLI Server",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -62,3 +62,15 @@ console.log(
console.log(` URI: ${containerImageUri}`); console.log(` URI: ${containerImageUri}`);
console.log(` Registry: ${containerImageRegistry}`); console.log(` Registry: ${containerImageRegistry}`);
console.log(` Image Name: ${containerImageName}`); console.log(` Image Name: ${containerImageName}`);
// Copy README.md to packages/cli
const rootReadmePath = path.resolve(__dirname, '../README.md');
const cliReadmePath = path.resolve(__dirname, '../packages/cli/README.md');
try {
fs.copyFileSync(rootReadmePath, cliReadmePath);
console.log('Copied root README.md to packages/cli/');
} catch (err) {
console.error('Error copying README.md:', err);
process.exit(1);
}