feat(ci): refactor release workflows for bundled and deprecated releases

This commit is contained in:
mkorwel
2025-10-28 12:57:46 -07:00
parent 3fa8a7e9fd
commit b89f64341e
4 changed files with 45 additions and 192 deletions
@@ -1,171 +0,0 @@
name: 'Publish Release Bundled'
description: 'Builds, prepares, and publishes a bundled gemini-cli package to npm and creates a GitHub release.'
inputs:
release-version:
description: 'The version to release (e.g., 0.1.11).'
required: true
npm-tag:
description: 'The npm tag to publish with (e.g., latest, preview, nightly).'
required: true
wombat-token-cli:
description: 'The npm token for the cli package.'
required: true
github-token:
description: 'The GitHub token for creating the release.'
required: true
dry-run:
description: 'Whether to run in dry-run mode.'
type: 'string'
required: true
release-tag:
description: 'The release tag for the release (e.g., v0.1.11).'
required: true
previous-tag:
description: 'The previous tag to use for generating release notes.'
required: true
skip-github-release:
description: 'Whether to skip creating a GitHub release.'
type: 'boolean'
required: false
default: false
working-directory:
description: 'The working directory to run the steps in.'
required: false
default: '.'
force-skip-tests:
description: 'Skip tests and validation'
required: false
default: false
skip-branch-cleanup:
description: 'Whether to skip cleaning up the release branch.'
type: 'boolean'
required: false
default: false
gemini_api_key:
description: 'The API key for running integration tests.'
required: true
npm-registry-publish-url:
description: 'npm registry publish url'
required: true
npm-registry-url:
description: 'npm registry url'
required: true
npm-registry-scope:
description: 'npm registry scope'
required: true
cli-package-name:
description: 'The name of the cli package.'
required: true
runs:
using: 'composite'
steps:
- name: '📝 Print Inputs'
shell: 'bash'
env:
JSON_INPUTS: '${{ toJSON(inputs) }}'
run: 'echo "$JSON_INPUTS"'
- name: '👤 Configure Git User'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
run: |
git config user.name "gemini-cli-robot"
git config user.email "gemini-cli-robot@google.com"
- name: '🌿 Create and switch to a release branch'
working-directory: '${{ inputs.working-directory }}'
id: 'release_branch'
shell: 'bash'
env:
RELEASE_TAG: '${{ inputs.release-tag }}'
run: |
BRANCH_NAME="release/${RELEASE_TAG}"
git switch -c "${BRANCH_NAME}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
- name: '⬆️ Update package versions'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
env:
RELEASE_VERSION: '${{ inputs.release-version }}'
run: |
npm run release:version "${RELEASE_VERSION}"
- name: '💾 Commit and Conditionally Push package versions'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
env:
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
DRY_RUN: '${{ inputs.dry-run }}'
RELEASE_TAG: '${{ inputs.release-tag }}'
run: |-
set -e
git add package.json package-lock.json packages/*/package.json
git commit -m "chore(release): ${RELEASE_TAG}"
if [[ "${DRY_RUN}" == "false" ]]; then
echo "Pushing release branch to remote..."
git push --set-upstream origin "${BRANCH_NAME}" --follow-tags
else
echo "Dry run enabled. Skipping push."
fi
- name: '🎁 Bundle'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
run: |
npm run bundle
- name: 'Configure npm for publishing'
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020'
with:
node-version-file: '${{ inputs.working-directory }}/.nvmrc'
registry-url: '${{inputs.npm-registry-publish-url}}'
scope: '${{inputs.npm-registry-scope}}'
cache-dependency-path: '${{ inputs.working-directory }}/package-lock.json'
cache: 'npm'
- name: '📦 Publish to NPM'
working-directory: '${{ inputs.working-directory }}'
env:
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-cli }}'
run: |
npm publish --dry-run="${{ inputs.dry-run }}"
- name: '🔬 Verify Bundled NPM release by version'
if: "${{ inputs.dry-run == 'false' && inputs.force-skip-tests == 'false' }}"
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
env:
CLI_PACKAGE_NAME: '${{ inputs.cli-package-name }}'
RELEASE_VERSION: '${{ inputs.release-version }}'
run: |
npx -y ${CLI_PACKAGE_NAME}@${RELEASE_VERSION} --version
- name: '🎉 Create GitHub Release'
working-directory: '${{ inputs.working-directory }}'
if: "${{ inputs.dry-run == 'false' && inputs.skip-github-release == 'false' && inputs.npm-tag != 'dev' && inputs.npm-registry-url != 'https://npm.pkg.github.com/' }}"
env:
GITHUB_TOKEN: '${{ inputs.github-token }}'
RELEASE_TAG: '${{ inputs.release-tag }}'
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
PREVIOUS_TAG: '${{ inputs.previous-tag }}'
shell: 'bash'
run: |
gh release create "${RELEASE_TAG}" \
bundle/gemini.js \
--target "${BRANCH_NAME}" \
--title "Release ${RELEASE_TAG}" \
--notes-start-tag "${PREVIOUS_TAG}" \
--generate-notes
- name: '🧹 Clean up release branch'
working-directory: '${{ inputs.working-directory }}'
if: "${{ inputs.dry-run == 'false' && inputs.skip-branch-cleanup == 'false' }}"
continue-on-error: true
shell: 'bash'
env:
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
run: |
echo "Cleaning up release branch ${BRANCH_NAME}..."
git push origin --delete "${BRANCH_NAME}"
+42 -18
View File
@@ -99,26 +99,50 @@ jobs:
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
working-directory: './release'
- name: 'Publish Release'
uses: './.github/actions/publish-release-bundled'
- name: 'Bundle'
working-directory: './release'
shell: 'bash'
run: 'npm run bundle'
- name: 'Prepare Package for Publishing'
if: "${{ vars.NPM_REGISTRY_SCOPE != '' }}"
working-directory: './release'
shell: 'bash'
env:
PACKAGE_SCOPE: '${{ vars.NPM_REGISTRY_SCOPE }}'
run: 'node scripts/prepare-package.js --scope=${{ env.PACKAGE_SCOPE }}'
- name: 'Publish Bundle'
uses: './.github/actions/publish-bundle'
with:
force-skip-tests: '${{ github.event.inputs.force_skip_tests }}'
release-version: '${{ steps.release_info.outputs.RELEASE_VERSION }}'
release-tag: '${{ github.event.inputs.version }}'
npm-tag: '${{ github.event.inputs.npm_channel }}'
wombat-token-cli: '${{ secrets.WOMBAT_TOKEN_CLI }}'
version: '${{ steps.release_info.outputs.RELEASE_VERSION }}'
tag: '${{ github.event.inputs.npm_channel }}'
github-token: '${{ secrets.GITHUB_TOKEN }}'
dry-run: '${{ github.event.inputs.dry_run }}'
previous-tag: '${{ steps.release_info.outputs.PREVIOUS_TAG }}'
skip-github-release: '${{ github.event.inputs.skip_github_release }}'
working-directory: './release'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
npm-registry-publish-url: '${{ vars.NPM_REGISTRY_PUBLISH_URL }}'
npm-registry-url: '${{ vars.NPM_REGISTRY_URL }}'
npm-registry-scope: '${{ vars.NPM_REGISTRY_SCOPE }}'
cli-package-name: '${{ vars.CLI_PACKAGE_NAME }}'
core-package-name: '${{ vars.CORE_PACKAGE_NAME }}'
a2a-package-name: '${{ vars.A2A_PACKAGE_NAME }}'
package-scope: '${{ vars.NPM_REGISTRY_SCOPE }}'
- name: '🔬 Verify Bundled NPM release by version'
if: "${{ github.event.inputs.dry_run == false && github.event.inputs.force_skip_tests == false }}"
working-directory: './release'
shell: 'bash'
env:
CLI_PACKAGE_NAME: '${{ vars.CLI_PACKAGE_NAME }}'
RELEASE_VERSION: '${{ steps.release_info.outputs.RELEASE_VERSION }}'
run: |
npx -y ${CLI_PACKAGE_NAME}@${RELEASE_VERSION} --version
- name: '🎉 Create GitHub Release'
working-directory: './release'
if: "${{ github.event.inputs.dry_run == false && github.event.inputs.skip_github_release == false && github.event.inputs.npm_channel != 'dev' && vars.NPM_REGISTRY_URL != 'https://npm.pkg.github.com/' }}"
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
RELEASE_TAG: '${{ github.event.inputs.version }}'
PREVIOUS_TAG: '${{ steps.release_info.outputs.PREVIOUS_TAG }}'
run: |
gh release create "${RELEASE_TAG}" \
bundle/gemini.js \
--title "Release ${RELEASE_TAG}" \
--notes-start-tag "${PREVIOUS_TAG}" \
--generate-notes
- name: 'Create Issue on Failure'
if: '${{ failure() && github.event.inputs.dry_run == false }}'
+1 -1
View File
@@ -100,7 +100,7 @@ jobs:
working-directory: './release'
- name: 'Publish Release'
uses: './.github/actions/publish-release'
uses: './.github/actions/publish-release-deprecated'
with:
force-skip-tests: '${{ github.event.inputs.force_skip_tests }}'
release-version: '${{ steps.release_info.outputs.RELEASE_VERSION }}'
+2 -2
View File
@@ -227,7 +227,7 @@ jobs:
run: 'npm ci'
- name: 'Publish Release'
uses: './.github/actions/publish-release'
uses: './.github/actions/publish-release-deprecated'
with:
release-version: '${{ needs.calculate-versions.outputs.PREVIEW_VERSION }}'
release-tag: 'v${{ needs.calculate-versions.outputs.PREVIEW_VERSION }}'
@@ -293,7 +293,7 @@ jobs:
run: 'npm ci'
- name: 'Publish Release'
uses: './.github/actions/publish-release'
uses: './.github/actions/publish-release-deprecated'
with:
release-version: '${{ needs.calculate-versions.outputs.STABLE_VERSION }}'
release-tag: 'v${{ needs.calculate-versions.outputs.STABLE_VERSION }}'