From b89f64341e921254020d09804a3a44cd5bb8b959 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Tue, 28 Oct 2025 12:57:46 -0700 Subject: [PATCH] feat(ci): refactor release workflows for bundled and deprecated releases --- .../publish-release-bundled/action.yml | 171 ------------------ .github/workflows/release-manual-bundled.yml | 60 ++++-- .github/workflows/release-manual.yml | 2 +- .github/workflows/release-promote.yml | 4 +- 4 files changed, 45 insertions(+), 192 deletions(-) delete mode 100644 .github/actions/publish-release-bundled/action.yml diff --git a/.github/actions/publish-release-bundled/action.yml b/.github/actions/publish-release-bundled/action.yml deleted file mode 100644 index 7d3b410e06..0000000000 --- a/.github/actions/publish-release-bundled/action.yml +++ /dev/null @@ -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}" \ No newline at end of file diff --git a/.github/workflows/release-manual-bundled.yml b/.github/workflows/release-manual-bundled.yml index c7194e53ad..d231b4a0cb 100644 --- a/.github/workflows/release-manual-bundled.yml +++ b/.github/workflows/release-manual-bundled.yml @@ -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 }}' diff --git a/.github/workflows/release-manual.yml b/.github/workflows/release-manual.yml index 836586e6b5..dd1aa1d0a2 100644 --- a/.github/workflows/release-manual.yml +++ b/.github/workflows/release-manual.yml @@ -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 }}' diff --git a/.github/workflows/release-promote.yml b/.github/workflows/release-promote.yml index da88a8238f..f53b77080f 100644 --- a/.github/workflows/release-promote.yml +++ b/.github/workflows/release-promote.yml @@ -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 }}'