From bf39c6e1041ceb53aaa342f209b06905ddf2cfde Mon Sep 17 00:00:00 2001 From: mkorwel Date: Tue, 1 Jul 2025 15:55:33 -0500 Subject: [PATCH] prep for release tagging --- .gcp/release-docker.yaml | 28 +++++++++++++++------ .github/workflows/release.yml | 47 ++++++----------------------------- scripts/build_sandbox.js | 3 ++- scripts/check-versions.js | 9 ++++--- 4 files changed, 35 insertions(+), 52 deletions(-) diff --git a/.gcp/release-docker.yaml b/.gcp/release-docker.yaml index c30c402271..6a8924a4ca 100644 --- a/.gcp/release-docker.yaml +++ b/.gcp/release-docker.yaml @@ -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' \ No newline at end of file + _CONTAINER_TOOL: 'docker' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7cfcdfe01..7809274a20 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 == '' diff --git a/scripts/build_sandbox.js b/scripts/build_sandbox.js index 0456a4c222..962f99d9e9 100644 --- a/scripts/build_sandbox.js +++ b/scripts/build_sandbox.js @@ -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( diff --git a/scripts/check-versions.js b/scripts/check-versions.js index 36b387f56e..230743a050 100644 --- a/scripts/check-versions.js +++ b/scripts/check-versions.js @@ -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.