prep for release tagging

This commit is contained in:
mkorwel
2025-07-01 15:55:33 -05:00
parent cf13466b9a
commit bf39c6e104
4 changed files with 35 additions and 52 deletions

View File

@@ -20,20 +20,34 @@ steps:
# Step 6: 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']
entrypoint: 'bash'
args:
- -c
- |
if [ "$_OFFICIAL_RELEASE" = "true" ]; then
export GEMINI_SANDBOX_IMAGE_TAG="${TAG_NAME#v}"
else
export GEMINI_SANDBOX_IMAGE_TAG="$SHORT_SHA"
fi
npm run build:sandbox:fast
env:
- 'GEMINI_SANDBOX_IMAGE_TAG=$SHORT_SHA'
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
# Step 7: 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']
entrypoint: 'bash'
args:
- -c
- |
if [ "$_OFFICIAL_RELEASE" = "true" ]; then
export GEMINI_SANDBOX_IMAGE_TAG="${TAG_NAME#v}"
else
export GEMINI_SANDBOX_IMAGE_TAG="$SHORT_SHA"
fi
npm run publish:sandbox
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
- 'GEMINI_SANDBOX_IMAGE_TAG=$SHORT_SHA'
options:
defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET
@@ -41,4 +55,4 @@ options:
substitutions:
_OFFICIAL_RELEASE: 'false'
_CONTAINER_TOOL: 'docker'
_CONTAINER_TOOL: 'docker'

View File

@@ -1,24 +1,9 @@
name: Release
on:
# Official Release: Triggered when a tag like v1.2.3 is pushed
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
# Pre-Release: Manual trigger from the GitHub Actions UI
workflow_dispatch:
inputs:
pre_release_tag:
description: 'NPM pre-release identifier (e.g., "beta", "next").'
required: true
default: 'next'
type: string
dry_run:
description: 'Whether to run the publish step in dry-run mode.'
required: true
type: boolean
default: true
push:
tags:
- 'v*.*.*'
jobs:
release:
@@ -67,32 +52,15 @@ jobs:
- name: Set Release Version and Tag
id: version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
# For official releases, use the git tag as the version
# Example: v1.2.3 -> 1.2.3
RELEASE_VERSION="${GITHUB_REF_NAME#v}"
NPM_TAG="latest"
RELEASE_VERSION="${GITHUB_REF_NAME#v}"
if [[ $RELEASE_VERSION == *-* ]]; then
NPM_TAG=$(echo $RELEASE_VERSION | cut -d'-' -f2 | cut -d'.' -f1)
else
# For pre-releases, create a version like 1.2.3-next.1
# and set the tag to "next"
npm version --no-git-tag-version prerelease --preid=${{ inputs.pre_release_tag }}
RELEASE_VERSION=$(node -p "require('./package.json').version")
NPM_TAG="${{ inputs.pre_release_tag }}"
NPM_TAG="latest"
fi
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
echo "NPM_TAG=${NPM_TAG}" >> $GITHUB_OUTPUT
- name: Determine Run Type
id: run_type
run: |
if [[ "${{ github.ref_type }}" == "tag" || "${{ inputs.dry_run }}" == "false" ]]; then
echo "NPM_DRY_RUN=" >> $GITHUB_OUTPUT
echo "DOCKER_DRY_RUN=" >> $GITHUB_OUTPUT
else
echo "NPM_DRY_RUN=--dry-run" >> $GITHUB_OUTPUT
echo "DOCKER_DRY_RUN=true" >> $GITHUB_OUTPUT
fi
- name: Configure npm for publishing
run: |
echo "registry=https://wombat-dressing-room.appspot.com/" > .npmrc
@@ -102,7 +70,6 @@ jobs:
run: npm run publish:npm
env:
NPM_PUBLISH_TAG: ${{ steps.version.outputs.NPM_TAG }}
NPM_DRY_RUN: ${{ steps.run_type.outputs.NPM_DRY_RUN }}
- name: Create GitHub Release
if: steps.run_type.outputs.NPM_DRY_RUN == ''

View File

@@ -123,7 +123,8 @@ function buildImage(imageName, dockerfile) {
readFileSync(join(process.cwd(), 'package.json'), 'utf-8'),
).version;
const imageTag = process.env.GEMINI_SANDBOX_IMAGE_TAG || imageName.split(':')[1];
const imageTag =
process.env.GEMINI_SANDBOX_IMAGE_TAG || imageName.split(':')[1];
const finalImageName = `${imageName.split(':')[0]}:${imageTag}`;
execSync(

View File

@@ -32,14 +32,15 @@ if (root.version !== cli.version || root.version !== core.version) {
// 2. Check that the cli's dependency on core matches the core version.
const coreDepVersion = cli.dependencies['@google/gemini-cli-core'];
const expectedCoreVersion = `^${core.version}`;
if (coreDepVersion !== expectedCoreVersion && coreDepVersion !== 'file:../core') {
if (
coreDepVersion !== expectedCoreVersion &&
coreDepVersion !== 'file:../core'
) {
errors.push(
`CLI dependency on core is wrong: expected ${expectedCoreVersion} or "file:../core", got ${coreDepVersion}`,
);
} else {
console.log(
`- CLI dependency on core (${coreDepVersion}) is correct.`,
);
console.log(`- CLI dependency on core (${coreDepVersion}) is correct.`);
}
// 3. Check that the sandbox image tag matches the root version.