Mk nightly relase tag formatting (#3206)

This commit is contained in:
matt korwel 2025-07-04 11:30:29 -05:00 committed by GitHub
parent 806d858c45
commit 9ff3592e01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 36 deletions

View File

@ -17,34 +17,48 @@ steps:
entrypoint: 'npm'
args: ['run', 'build:packages']
# Step 6: Build sandbox container image
# Step 6: Determine Docker Image Tag
- name: 'us-west1-docker.pkg.dev/gemini-code-dev/gemini-code-containers/gemini-code-builder'
id: 'Determine Docker Image Tag'
entrypoint: 'bash'
args:
- -c
- |
FINAL_TAG="$SHORT_SHA" # Default to SHA
if [[ "$TAG_NAME" == *"-nightly"* ]]; then
echo "Nightly release detected."
FINAL_TAG="${TAG_NAME#v}"
elif [[ "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Official release detected."
FINAL_TAG="${TAG_NAME#v}"
else
echo "Development/RC release detected. Using commit SHA as tag."
fi
echo "Determined image tag: $FINAL_TAG"
echo "$FINAL_TAG" > /workspace/image_tag.txt
# 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: '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
export GEMINI_SANDBOX_IMAGE_TAG=$(cat /workspace/image_tag.txt)
echo "Using Docker image tag for build: $GEMINI_SANDBOX_IMAGE_TAG"
npm run build:sandbox:fast
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
# Step 7: Publish sandbox container image
# 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: '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
export GEMINI_SANDBOX_IMAGE_TAG=$(cat /workspace/image_tag.txt)
echo "Using Docker image tag for publish: $GEMINI_SANDBOX_IMAGE_TAG"
npm run publish:sandbox
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'
@ -54,5 +68,4 @@ options:
dynamicSubstitutions: true
substitutions:
_OFFICIAL_RELEASE: 'false'
_CONTAINER_TOOL: 'docker'

View File

@ -72,8 +72,6 @@ jobs:
RELEASE_VERSION="${RELEASE_TAG#v}"
if [[ $RELEASE_VERSION == *-* ]]; then
NPM_TAG=$(echo $RELEASE_VERSION | cut -d'-' -f2 | cut -d'.' -f1)
elif [[ $RELEASE_VERSION == *+* ]]; then
NPM_TAG=$(echo $RELEASE_VERSION | cut -d'+' -f2 | cut -d'.' -f1)
else
NPM_TAG="latest"
fi
@ -102,25 +100,8 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json packages/*/package.json
if ! git diff-index --quiet HEAD --; then
echo "Changes detected, creating commit."
git commit -m "chore(release): ${{ steps.version.outputs.RELEASE_TAG }}"
git push --set-upstream origin ${{ steps.release_branch.outputs.BRANCH_NAME }} --follow-tags
else
echo "No version changes to commit."
fi
- name: Create GitHub Release and Tag
if: '!inputs.dry_run'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: ${{ steps.release_branch.outputs.BRANCH_NAME }}
run: |
gh release create ${{ steps.version.outputs.RELEASE_TAG }} \
bundle/gemini.js \
--target "$RELEASE_BRANCH" \
--title "Release ${{ steps.version.outputs.RELEASE_TAG }}" \
--generate-notes
git commit -m "chore(release): ${{ steps.version.outputs.RELEASE_TAG }}"
git push --set-upstream origin ${{ steps.release_branch.outputs.BRANCH_NAME }} --follow-tags
- name: Build and Prepare Packages
run: |
@ -140,9 +121,21 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.WOMBAT_TOKEN_CORE }}
- name: Install latest core package
run: npm install @google/gemini-cli-core@${{ steps.version.outputs.RELEASE_VERSION }} --workspace=@google/gemini-cli --save-exact
run: npm install @google/gemini-cli-core@${{ steps.version.outputs.NPM_TAG }} --workspace=@google/gemini-cli --save-exact
- name: Publish @google/gemini-cli
run: npm publish --workspace=@google/gemini-cli --tag=${{ steps.version.outputs.NPM_TAG }} ${{ inputs.dry_run && '--dry-run' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.WOMBAT_TOKEN_CLI }}
- name: Create GitHub Release and Tag
if: '!inputs.dry_run'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: ${{ steps.release_branch.outputs.BRANCH_NAME }}
run: |
gh release create ${{ steps.version.outputs.RELEASE_TAG }} \
bundle/gemini.js \
--target "$RELEASE_BRANCH" \
--title "Release ${{ steps.version.outputs.RELEASE_TAG }}" \
--generate-notes

View File

@ -51,7 +51,7 @@
"publish:release": "npm run prepare:package && npm run build:packages && npm run build:sandbox:fast && npm run publish:sandbox && npm run publish:npm",
"prepublishOnly": "node scripts/check-versions.js && node scripts/prepublish.js",
"release:version": "node scripts/version.js",
"tag:release:nightly": "TAG_NAME=\"v$(node -p \"require('./package.json').version\")+nightly.$(date -u +%d%m%y).$(git rev-parse --short HEAD)\"; git tag -a $TAG_NAME -m '' && git push origin $TAG_NAME",
"tag:release:nightly": "TAG_NAME=\"v$(node -p \"require('./package.json').version\")-nightly.$(date -u +%y%m%d).$(git rev-parse --short HEAD)\"; git tag -a $TAG_NAME -m '' && git push origin $TAG_NAME",
"check:versions": "node scripts/check-versions.js",
"publish:actions-release": "npm run prepare:package && npm run build:packages && npm run publish:npm"
},