Skip to content

Commit 6acdd60

Browse files
Refactor Github Action per b/485167538
1 parent 4fb8dfe commit 6acdd60

7 files changed

Lines changed: 72 additions & 29 deletions

File tree

.github/actions/publish-release/action.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,19 @@ runs:
5252
id: 'release_branch'
5353
shell: 'bash'
5454
run: |
55-
BRANCH_NAME="release/${{ inputs.release-tag }}"
55+
BRANCH_NAME="release/${INPUTS_RELEASE_TAG}"
5656
git switch -c "${BRANCH_NAME}"
5757
echo "BRANCH_NAME=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
58+
env:
59+
INPUTS_RELEASE_TAG: ${{ inputs.release-tag }}
5860

5961
- name: '⬆️ Update package versions'
6062
working-directory: '${{ inputs.working-directory }}'
6163
shell: 'bash'
6264
run: |
63-
npm run release:version "${{ inputs.release-version }}"
65+
npm run release:version "${INPUTS_RELEASE_VERSION}"
66+
env:
67+
INPUTS_RELEASE_VERSION: ${{ inputs.release-version }}
6468

6569
- name: '💾 Commit and Conditionally Push package versions'
6670
working-directory: '${{ inputs.working-directory }}'
@@ -97,32 +101,38 @@ runs:
97101
working-directory: '${{ inputs.working-directory }}'
98102
env:
99103
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-core }}'
104+
INPUTS_DRY_RUN: ${{ inputs.dry-run }}
105+
INPUTS_NPM_TAG: ${{ inputs.npm-tag }}
100106
shell: 'bash'
101107
run: |
102108
npm publish \
103-
--dry-run="${{ inputs.dry-run }}" \
109+
--dry-run="${INPUTS_DRY_RUN}" \
104110
--workspace="@google/gemini-cli-core" \
105-
--tag="${{ inputs.npm-tag }}"
111+
--tag="${INPUTS_NPM_TAG}"
106112
107113
- name: '🔗 Install latest core package'
108114
working-directory: '${{ inputs.working-directory }}'
109115
if: "${{ inputs.dry-run == 'false' }}"
110116
shell: 'bash'
111117
run: |
112-
npm install "@google/gemini-cli-core@${{ inputs.release-version }}" \
118+
npm install "@google/gemini-cli-core@${INPUTS_RELEASE_VERSION}" \
113119
--workspace="@google/gemini-cli" \
114120
--save-exact
121+
env:
122+
INPUTS_RELEASE_VERSION: ${{ inputs.release-version }}
115123

116124
- name: '📦 Publish @google/gemini-cli'
117125
working-directory: '${{ inputs.working-directory }}'
118126
env:
119127
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-cli }}'
128+
INPUTS_DRY_RUN: ${{ inputs.dry-run }}
129+
INPUTS_NPM_TAG: ${{ inputs.npm-tag }}
120130
shell: 'bash'
121131
run: |
122132
npm publish \
123-
--dry-run="${{ inputs.dry-run }}" \
133+
--dry-run="${INPUTS_DRY_RUN}" \
124134
--workspace="@google/gemini-cli" \
125-
--tag="${{ inputs.npm-tag }}"
135+
--tag="${INPUTS_NPM_TAG}"
126136
127137
- name: '🎁 Bundle'
128138
working-directory: '${{ inputs.working-directory }}'
@@ -135,11 +145,14 @@ runs:
135145
if: "${{ inputs.dry-run == 'false' }}"
136146
env:
137147
GITHUB_TOKEN: '${{ inputs.github-token }}'
148+
INPUTS_RELEASE_TAG: ${{ inputs.release-tag }}
149+
STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME: ${{ steps.release_branch.outputs.BRANCH_NAME }}
150+
INPUTS_PREVIOUS_TAG: ${{ inputs.previous-tag }}
138151
shell: 'bash'
139152
run: |
140-
gh release create "${{ inputs.release-tag }}" \
153+
gh release create "${INPUTS_RELEASE_TAG}" \
141154
bundle/gemini.js \
142-
--target "${{ steps.release_branch.outputs.BRANCH_NAME }}" \
143-
--title "Release ${{ inputs.release-tag }}" \
144-
--notes-start-tag "${{ inputs.previous-tag }}" \
155+
--target "${STEPS_RELEASE_BRANCH_OUTPUTS_BRANCH_NAME}" \
156+
--title "Release ${INPUTS_RELEASE_TAG}" \
157+
--notes-start-tag "${INPUTS_PREVIOUS_TAG}" \
145158
--generate-notes

.github/workflows/create-patch-pr.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ jobs:
5050
if: "github.event.inputs.channel == 'stable'"
5151
env:
5252
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
53-
run: 'node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=stable --dry-run=${{ github.event.inputs.dry_run }}'
53+
GITHUB_EVENT_INPUTS_COMMIT: ${{ github.event.inputs.commit }}
54+
GITHUB_EVENT_INPUTS_DRY_RUN: ${{ github.event.inputs.dry_run }}
55+
run: 'node scripts/create-patch-pr.js --commit=${GITHUB_EVENT_INPUTS_COMMIT} --channel=stable --dry-run=${GITHUB_EVENT_INPUTS_DRY_RUN}'
5456

5557
- name: 'Create Patch for Preview'
5658
env:
5759
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
58-
run: 'node scripts/create-patch-pr.js --commit=${{ github.event.inputs.commit }} --channel=${{ github.event.inputs.channel }} --dry-run=${{ github.event.inputs.dry_run }}'
60+
GITHUB_EVENT_INPUTS_COMMIT: ${{ github.event.inputs.commit }}
61+
GITHUB_EVENT_INPUTS_CHANNEL: ${{ github.event.inputs.channel }}
62+
GITHUB_EVENT_INPUTS_DRY_RUN: ${{ github.event.inputs.dry_run }}
63+
run: 'node scripts/create-patch-pr.js --commit=${GITHUB_EVENT_INPUTS_COMMIT} --channel=${GITHUB_EVENT_INPUTS_CHANNEL} --dry-run=${GITHUB_EVENT_INPUTS_DRY_RUN}'

.github/workflows/eval.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ jobs:
4444
- name: 'Run evaluation'
4545
working-directory: '/app'
4646
run: |
47-
poetry run exp_run --experiment-mode=on-demand --branch-or-commit=${{ github.ref_name }} --model-name=gemini-2.5-pro --dataset=swebench_verified --concurrency=15
47+
poetry run exp_run --experiment-mode=on-demand --branch-or-commit=${GITHUB_REF_NAME} --model-name=gemini-2.5-pro --dataset=swebench_verified --concurrency=15
4848
poetry run python agent_prototypes/scripts/parse_gcli_logs_experiment.py --experiment_dir=experiments/adhoc/gcli_temp_exp --gcs-bucket="${EVAL_GCS_BUCKET}" --gcs-path=gh_action_artifacts

.github/workflows/gemini-automated-issue-triage.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ jobs:
7171
if: |-
7272
github.event_name == 'workflow_dispatch' && !contains(steps.get_issue_data.outputs.labels, 'status/need-triage')
7373
run: |
74-
echo "Issue #${{ github.event.inputs.issue_number }} does not have the 'status/need-triage' label. Stopping workflow."
74+
echo "Issue #${GITHUB_EVENT_INPUTS_ISSUE_NUMBER} does not have the 'status/need-triage' label. Stopping workflow."
7575
exit 1
76+
env:
77+
GITHUB_EVENT_INPUTS_ISSUE_NUMBER: ${{ github.event.inputs.issue_number }}
7678

7779
- name: 'Checkout'
7880
uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5

.github/workflows/patch-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ jobs:
6363
id: 'version'
6464
env:
6565
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
66+
GITHUB_EVENT_INPUTS_TYPE: ${{ github.event.inputs.type }}
6667
run: |-
67-
VERSION_JSON="$(node scripts/get-release-version.js --type=patch --patch-from=${{ github.event.inputs.type }})"
68+
VERSION_JSON="$(node scripts/get-release-version.js --type=patch --patch-from=${GITHUB_EVENT_INPUTS_TYPE})"
6869
echo "${VERSION_JSON}"
6970
echo "RELEASE_TAG=$(echo "${VERSION_JSON}" | jq -r .releaseTag)" >> "${GITHUB_OUTPUT}"
7071
echo "RELEASE_VERSION=$(echo "${VERSION_JSON}" | jq -r .releaseVersion)" >> "${GITHUB_OUTPUT}"
@@ -73,7 +74,9 @@ jobs:
7374
7475
- name: 'Print Calculated Version'
7576
run: |-
76-
echo "Calculated version: ${{ steps.version.outputs.RELEASE_VERSION }}"
77+
echo "Calculated version: ${STEPS_VERSION_OUTPUTS_RELEASE_VERSION}"
78+
env:
79+
STEPS_VERSION_OUTPUTS_RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
7780

7881
- name: 'Run Tests'
7982
uses: './.github/actions/run-tests'

.github/workflows/promote-release.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
id: 'versions'
6767
env:
6868
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
69+
GITHUB_EVENT_INPUTS_REF: ${{ github.event.inputs.ref }}
6970
run: |
7071
set -e
7172
STABLE_JSON=$(node scripts/get-release-version.js --type=stable ${{ github.event.inputs.stable_version_override && format('--stable_version_override={0}', github.event.inputs.stable_version_override) || '' }})
@@ -83,7 +84,7 @@ jobs:
8384
echo "PREVIOUS_STABLE_TAG=$(echo "${STABLE_JSON}" | jq -r .previousReleaseTag)" >> "${GITHUB_OUTPUT}"
8485
echo "PREVIEW_VERSION=$(echo "${PREVIEW_JSON}" | jq -r .releaseVersion)" >> "${GITHUB_OUTPUT}"
8586
# shellcheck disable=SC1083
86-
echo "PREVIEW_SHA=$(git rev-parse '${{ github.event.inputs.ref }}'^{commit})" >> "${GITHUB_OUTPUT}"
87+
echo "PREVIEW_SHA=$(git rev-parse '${GITHUB_EVENT_INPUTS_REF}'^{commit})" >> "${GITHUB_OUTPUT}"
8788
echo "PREVIOUS_PREVIEW_TAG=$(echo "${PREVIEW_JSON}" | jq -r .previousReleaseTag)" >> "${GITHUB_OUTPUT}"
8889
echo "NEXT_NIGHTLY_VERSION=$(echo "${NIGHTLY_JSON}" | jq -r .releaseVersion)" >> "${GITHUB_OUTPUT}"
8990
echo "PREVIOUS_NIGHTLY_TAG=$(echo "${NIGHTLY_JSON}" | jq -r .previousReleaseTag)" >> "${GITHUB_OUTPUT}"
@@ -94,14 +95,25 @@ jobs:
9495
- name: 'Display Pending Updates'
9596
run: |
9697
echo "Pending Changes, Next Versions:"
97-
echo " Nightly: ${{ steps.versions.outputs.NEXT_NIGHTLY_VERSION }}"
98-
echo " Preview: ${{ steps.versions.outputs.PREVIEW_VERSION }}"
99-
echo " Stable: ${{ steps.versions.outputs.STABLE_VERSION }}"
98+
echo " Nightly: ${STEPS_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION}"
99+
echo " Preview: ${STEPS_VERSIONS_OUTPUTS_PREVIEW_VERSION}"
100+
echo " Stable: ${STEPS_VERSIONS_OUTPUTS_STABLE_VERSION}"
100101
echo ""
101102
echo "Relevant SHAs:"
102-
echo " Stable: Will be cut from: : ${{ steps.versions.outputs.STABLE_SHA }} / ${{ steps.versions.outputs.PREVIOUS_STABLE_TAG }}"
103-
echo " Preview will be cut from: : ${{ steps.versions.outputs.PREVIEW_SHA }} (${{ github.event.inputs.ref }})". Users last saw preview as: ${{ steps.versions.outputs.PREVIOUS_PREVIEW_TAG }}
104-
echo " Nightly will be udpated in : ${{ steps.versions.outputs.NEXT_SHA }} (${{ github.event.inputs.ref }}). Previous nightly tag: ${{ steps.versions.outputs.PREVIOUS_NIGHTLY_TAG }}"
103+
echo " Stable: Will be cut from: : ${STEPS_VERSIONS_OUTPUTS_STABLE_SHA} / ${STEPS_VERSIONS_OUTPUTS_PREVIOUS_STABLE_TAG}"
104+
echo " Preview will be cut from: : ${STEPS_VERSIONS_OUTPUTS_PREVIEW_SHA} (${GITHUB_EVENT_INPUTS_REF})". Users last saw preview as: ${STEPS_VERSIONS_OUTPUTS_PREVIOUS_PREVIEW_TAG}
105+
echo " Nightly will be udpated in : ${STEPS_VERSIONS_OUTPUTS_NEXT_SHA} (${GITHUB_EVENT_INPUTS_REF}). Previous nightly tag: ${STEPS_VERSIONS_OUTPUTS_PREVIOUS_NIGHTLY_TAG}"
106+
env:
107+
STEPS_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION: ${{ steps.versions.outputs.NEXT_NIGHTLY_VERSION }}
108+
STEPS_VERSIONS_OUTPUTS_PREVIEW_VERSION: ${{ steps.versions.outputs.PREVIEW_VERSION }}
109+
STEPS_VERSIONS_OUTPUTS_STABLE_VERSION: ${{ steps.versions.outputs.STABLE_VERSION }}
110+
STEPS_VERSIONS_OUTPUTS_STABLE_SHA: ${{ steps.versions.outputs.STABLE_SHA }}
111+
STEPS_VERSIONS_OUTPUTS_PREVIOUS_STABLE_TAG: ${{ steps.versions.outputs.PREVIOUS_STABLE_TAG }}
112+
STEPS_VERSIONS_OUTPUTS_PREVIEW_SHA: ${{ steps.versions.outputs.PREVIEW_SHA }}
113+
GITHUB_EVENT_INPUTS_REF: ${{ github.event.inputs.ref }}
114+
STEPS_VERSIONS_OUTPUTS_PREVIOUS_PREVIEW_TAG: ${{ steps.versions.outputs.PREVIOUS_PREVIEW_TAG }}
115+
STEPS_VERSIONS_OUTPUTS_NEXT_SHA: ${{ steps.versions.outputs.NEXT_SHA }}
116+
STEPS_VERSIONS_OUTPUTS_PREVIOUS_NIGHTLY_TAG: ${{ steps.versions.outputs.PREVIOUS_NIGHTLY_TAG }}
105117

106118
test:
107119
name: 'Test ${{ matrix.channel }}'
@@ -290,23 +302,28 @@ jobs:
290302
- name: 'Create and switch to a new branch'
291303
id: 'release_branch'
292304
run: |
293-
BRANCH_NAME="chore/nightly-version-bump-${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}"
305+
BRANCH_NAME="chore/nightly-version-bump-${NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION}"
294306
git switch -c "${BRANCH_NAME}"
295307
echo "BRANCH_NAME=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
308+
env:
309+
NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION: ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}
296310

297311
- name: 'Update package versions'
298-
run: 'npm run release:version "${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}"'
312+
run: 'npm run release:version "${NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION}"'
313+
env:
314+
NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION: ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}
299315

300316
- name: 'Commit and Push package versions'
301317
env:
302318
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
303319
DRY_RUN: '${{ github.event.inputs.dry_run }}'
320+
NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION: ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}
304321
run: |-
305322
git add package.json packages/*/package.json
306323
if [ -f package-lock.json ]; then
307324
git add package-lock.json
308325
fi
309-
git commit -m "chore(release): bump version to ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}"
326+
git commit -m "chore(release): bump version to ${NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION}"
310327
if [[ "${DRY_RUN}" == "false" ]]; then
311328
echo "Pushing release branch to remote..."
312329
git push --set-upstream origin "${BRANCH_NAME}"
@@ -320,9 +337,10 @@ jobs:
320337
env:
321338
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
322339
BRANCH_NAME: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
340+
NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION: ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}
323341
run: |
324342
gh pr create \
325-
--title "chore(release): bump version to ${{ needs.calculate-versions.outputs.NEXT_NIGHTLY_VERSION }}" \
343+
--title "chore(release): bump version to ${NEEDS_CALCULATE_VERSIONS_OUTPUTS_NEXT_NIGHTLY_VERSION}" \
326344
--body "Automated version bump to prepare for the next nightly release." \
327345
--base "main" \
328346
--head "${BRANCH_NAME}" \

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- name: 'Get the version'
7171
id: 'version'
7272
run: |-
73-
RELEASE_TAG="${{ inputs.version }}"
73+
RELEASE_TAG="${INPUTS_VERSION}"
7474
# The version for npm should not have the 'v' prefix.
7575
RELEASE_VERSION="${RELEASE_TAG#v}"
7676
NPM_TAG="latest"
@@ -82,6 +82,8 @@ jobs:
8282
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
8383
echo "NPM_TAG=${NPM_TAG}" >> "${GITHUB_OUTPUT}"
8484
echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> "${GITHUB_OUTPUT}"
85+
env:
86+
INPUTS_VERSION: ${{ inputs.version }}
8587

8688
- name: 'Run Tests'
8789
if: |-

0 commit comments

Comments
 (0)