From e98f41fe86b6d1039505a36f3ed675c37e43c297 Mon Sep 17 00:00:00 2001 From: Google Admin Date: Tue, 17 Feb 2026 21:36:19 -0500 Subject: [PATCH] Refactor Github Action per b/485167538 (#19295) Co-authored-by: Ben Knutson --- .../actions/post-coverage-comment/action.yml | 17 +++++--- .github/workflows/release.yml | 40 +++++++++++++------ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/.github/actions/post-coverage-comment/action.yml b/.github/actions/post-coverage-comment/action.yml index 10a4afeb72..c47e21f475 100644 --- a/.github/actions/post-coverage-comment/action.yml +++ b/.github/actions/post-coverage-comment/action.yml @@ -31,10 +31,10 @@ runs: id: prep_coverage_comment shell: bash run: | - cli_json_file="${{ inputs.cli_json_file }}" - core_json_file="${{ inputs.core_json_file }}" - cli_full_text_summary_file="${{ inputs.cli_full_text_summary_file }}" - core_full_text_summary_file="${{ inputs.core_full_text_summary_file }}" + cli_json_file="${INPUTS_CLI_JSON_FILE}" + core_json_file="${INPUTS_CORE_JSON_FILE}" + cli_full_text_summary_file="${INPUTS_CLI_FULL_TEXT_SUMMARY_FILE}" + core_full_text_summary_file="${INPUTS_CORE_FULL_TEXT_SUMMARY_FILE}" comment_file="coverage-comment.md" # Extract percentages using jq for the main table @@ -94,7 +94,14 @@ runs: echo "" >> "$comment_file" echo "" >> "$comment_file" - echo "_For detailed HTML reports, please see the 'coverage-reports-${{ inputs.node_version }}-${{ inputs.os }}' artifact from the main CI run._" >> "$comment_file" + echo "_For detailed HTML reports, please see the 'coverage-reports-${INPUTS_NODE_VERSION}-${INPUTS_OS}' artifact from the main CI run._" >> "$comment_file" + env: + INPUTS_CLI_JSON_FILE: ${{ inputs.cli_json_file }} + INPUTS_CORE_JSON_FILE: ${{ inputs.core_json_file }} + INPUTS_CLI_FULL_TEXT_SUMMARY_FILE: ${{ inputs.cli_full_text_summary_file }} + INPUTS_CORE_FULL_TEXT_SUMMARY_FILE: ${{ inputs.core_full_text_summary_file }} + INPUTS_NODE_VERSION: ${{ inputs.node_version }} + INPUTS_OS: ${{ inputs.os }} - name: Post Coverage Comment uses: thollander/actions-comment-pull-request@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbbcdbe97b..37ba0e55a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,16 +57,19 @@ jobs: id: vars run: | is_nightly="false" - if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event.inputs.create_nightly_release }}" == "true" ]]; then + if [[ "${{ github.event_name }}" == "schedule" || "${GITHUB_EVENT_INPUTS_CREATE_NIGHTLY_RELEASE}" == "true" ]]; then is_nightly="true" fi echo "is_nightly=${is_nightly}" >> $GITHUB_OUTPUT is_dry_run="false" - if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then + if [[ "${GITHUB_EVENT_INPUTS_DRY_RUN}" == "true" ]]; then is_dry_run="true" fi echo "is_dry_run=${is_dry_run}" >> $GITHUB_OUTPUT + env: + GITHUB_EVENT_INPUTS_CREATE_NIGHTLY_RELEASE: ${{ github.event.inputs.create_nightly_release }} + GITHUB_EVENT_INPUTS_DRY_RUN: ${{ github.event.inputs.dry_run }} - name: Setup Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 @@ -110,24 +113,32 @@ jobs: - name: Create and switch to a release branch id: release_branch run: | - BRANCH_NAME="release/${{ steps.version.outputs.RELEASE_TAG }}" + BRANCH_NAME="release/${STEPS_VERSION_OUTPUTS_RELEASE_TAG}" git switch -c $BRANCH_NAME echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT + env: + STEPS_VERSION_OUTPUTS_RELEASE_TAG: ${{ steps.version.outputs.RELEASE_TAG }} - name: Update package versions run: | - npm run release:version ${{ steps.version.outputs.RELEASE_VERSION }} + npm run release:version ${STEPS_VERSION_OUTPUTS_RELEASE_VERSION} + env: + STEPS_VERSION_OUTPUTS_RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }} - name: Commit and Conditionally Push package versions run: | git add package.json package-lock.json packages/*/package.json - git commit -m "chore(release): ${{ steps.version.outputs.RELEASE_TAG }}" - if [[ "${{ steps.vars.outputs.is_dry_run }}" == "false" ]]; then + git commit -m "chore(release): ${STEPS_VERSION_OUTPUTS_RELEASE_TAG}" + if [[ "${STEPS_VARS_OUTPUTS_IS_DRY_RUN}" == "false" ]]; then echo "Pushing release branch to remote..." - git push --set-upstream origin ${{ steps.release_branch.outputs.BRANCH_NAME }} --follow-tags + git push --set-upstream origin ${STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME} --follow-tags else echo "Dry run enabled. Skipping push." fi + env: + STEPS_VERSION_OUTPUTS_RELEASE_TAG: ${{ steps.version.outputs.RELEASE_TAG }} + STEPS_VARS_OUTPUTS_IS_DRY_RUN: ${{ steps.vars.outputs.is_dry_run }} + STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME: ${{ steps.release_branch.outputs.BRANCH_NAME }} - name: Build and Prepare Packages run: | @@ -145,30 +156,35 @@ jobs: scope: '@google' - name: Publish @google/gemini-cli-core - run: npm publish --workspace=@google/gemini-cli-core --tag=${{ steps.version.outputs.NPM_TAG }} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} + run: npm publish --workspace=@google/gemini-cli-core --tag=${STEPS_VERSION_OUTPUTS_NPM_TAG} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} env: NODE_AUTH_TOKEN: ${{ secrets.WOMBAT_TOKEN_CORE }} + STEPS_VERSION_OUTPUTS_NPM_TAG: ${{ steps.version.outputs.NPM_TAG }} - name: Install latest core package if: steps.vars.outputs.is_dry_run == 'false' - 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_RELEASE_VERSION} --workspace=@google/gemini-cli --save-exact + env: + STEPS_VERSION_OUTPUTS_RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }} - name: Publish @google/gemini-cli - run: npm publish --workspace=@google/gemini-cli --tag=${{ steps.version.outputs.NPM_TAG }} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} + run: npm publish --workspace=@google/gemini-cli --tag=${STEPS_VERSION_OUTPUTS_NPM_TAG} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} env: NODE_AUTH_TOKEN: ${{ secrets.WOMBAT_TOKEN_CLI }} + STEPS_VERSION_OUTPUTS_NPM_TAG: ${{ steps.version.outputs.NPM_TAG }} - name: Create GitHub Release and Tag if: ${{ steps.vars.outputs.is_dry_run == 'false' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_BRANCH: ${{ steps.release_branch.outputs.BRANCH_NAME }} + STEPS_VERSION_OUTPUTS_RELEASE_TAG: ${{ steps.version.outputs.RELEASE_TAG }} run: | - gh release create ${{ steps.version.outputs.RELEASE_TAG }} \ + gh release create ${STEPS_VERSION_OUTPUTS_RELEASE_TAG} \ bundle/gemini.js \ bundle/binaries/* \ --target "$RELEASE_BRANCH" \ - --title "Release ${{ steps.version.outputs.RELEASE_TAG }}" \ + --title "Release ${STEPS_VERSION_OUTPUTS_RELEASE_TAG}" \ --generate-notes - name: Create Issue on Failure