Skip to content

Commit 93e022c

Browse files
feat(ci): Add a "verify release" action + workflow to the pipeline (#8929)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
1 parent 710e00e commit 93e022c

6 files changed

Lines changed: 180 additions & 25 deletions

File tree

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ inputs:
3636
description: 'The working directory to run the steps in.'
3737
required: false
3838
default: '.'
39+
force-skip-tests:
40+
description: 'Skip tests and validation'
41+
required: false
42+
default: false
3943

4044
runs:
4145
using: 'composite'
@@ -107,7 +111,7 @@ runs:
107111
npm publish \
108112
--dry-run="${{ inputs.dry-run }}" \
109113
--workspace="@google/gemini-cli-core" \
110-
--tag="${{ inputs.npm-tag }}"
114+
--no-tag
111115
112116
- name: '🔗 Install latest core package'
113117
working-directory: '${{ inputs.working-directory }}'
@@ -127,7 +131,31 @@ runs:
127131
npm publish \
128132
--dry-run="${{ inputs.dry-run }}" \
129133
--workspace="@google/gemini-cli" \
130-
--tag="${{ inputs.npm-tag }}"
134+
--no-tag
135+
136+
- name: '🔬 Verify NPM release by version'
137+
uses: './.github/actions/verify-release'
138+
if: "${{ inputs.dry-run == 'false' && inputs.force-skip-tests == 'false' }}"
139+
with:
140+
npm-package: '@google/gemini-cli@${{ inputs.release-version }}'
141+
expected-version: '${{ inputs.release-version }}'
142+
ref: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
143+
144+
- name: '🏷️ Tag release'
145+
uses: './.github/actions/tag-npm-release'
146+
if: "${{ inputs.dry-run == 'false' }}"
147+
with:
148+
channel: '${{ inputs.npm-tag }}'
149+
version: '${{ inputs.release-version }}'
150+
dry-run: '${{ inputs.dry-run }}'
151+
wombat-token-core: '${{ inputs.wombat-token-core }}'
152+
wombat-token-cli: '${{ inputs.wombat-token-cli }}'
153+
154+
- name: 'Install deps'
155+
working-directory: '${{ inputs.working-directory }}'
156+
shell: 'bash'
157+
run: |
158+
npm install
131159
132160
- name: '🎁 Bundle'
133161
working-directory: '${{ inputs.working-directory }}'
@@ -137,7 +165,7 @@ runs:
137165
138166
- name: '🎉 Create GitHub Release'
139167
working-directory: '${{ inputs.working-directory }}'
140-
if: "${{ inputs.dry-run == 'false' && inputs.skip-github-release == 'false' }}"
168+
if: "${{ inputs.dry-run == 'false' && inputs.skip-github-release == 'false' && inputs.npm-tag != 'dev' }}"
141169
env:
142170
GITHUB_TOKEN: '${{ inputs.github-token }}'
143171
shell: 'bash'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Tag an NPM release'
2+
description: 'Tags a specific npm version to a specific channel.'
3+
4+
inputs:
5+
channel:
6+
description: 'NPM Channel tag'
7+
required: true
8+
version:
9+
description: 'version'
10+
required: true
11+
dry-run:
12+
description: 'Whether to run in dry-run mode.'
13+
required: true
14+
wombat-token-core:
15+
description: 'The npm token for the wombat @google/gemini-cli-core'
16+
required: true
17+
wombat-token-cli:
18+
description: 'The npm token for wombat @google/gemini-cli'
19+
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- name: 'Setup Node.js'
24+
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020'
25+
with:
26+
node-version-file: '.nvmrc'
27+
registry-url: 'https://wombat-dressing-room.appspot.com'
28+
scope: '@google'
29+
30+
- name: 'Change tag for @google/gemini-cli-core'
31+
if: |-
32+
${{ inputs.dry-run == 'false' }}
33+
env:
34+
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-core }}'
35+
shell: 'bash'
36+
run: |
37+
npm dist-tag add @google/gemini-cli-core@${{ inputs.version }} ${{ inputs.channel }}
38+
39+
- name: 'Change tag for @google/gemini-cli'
40+
if: |-
41+
${{ inputs.dry-run == 'false' }}
42+
env:
43+
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-cli }}'
44+
shell: 'bash'
45+
run: |
46+
npm dist-tag add @google/gemini-cli@${{ inputs.version }} ${{ inputs.channel }}
47+
48+
- name: 'Log dry run'
49+
if: |-
50+
${{ inputs.dry-run == 'true' }}
51+
shell: 'bash'
52+
run: |
53+
echo "Dry run: Would have added tag '${{ inputs.channel }}' to version '${{ inputs.version }}' for @google/gemini-cli and @google/gemini-cli-core."
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Verify an NPM release'
2+
description: 'Fetches a package from NPM and does some basic smoke tests'
3+
4+
inputs:
5+
npm-package:
6+
description: 'NPM Package'
7+
required: true
8+
default: '@google/gemini-cli@latest'
9+
expected-version:
10+
description: 'Expected version'
11+
required: true
12+
ref:
13+
description: 'The branch, tag, or SHA to release from.'
14+
required: false
15+
type: 'string'
16+
default: 'main'
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: '📝 Print Inputs'
22+
shell: 'bash'
23+
run: |
24+
echo "${{ toJSON(inputs) }}"
25+
- name: 'Checkout'
26+
uses: 'actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955' # ratchet:actions/checkout@v4
27+
with:
28+
ref: '${{ github.event.inputs.ref }}'
29+
fetch-depth: 0
30+
31+
- name: 'Install from NPM'
32+
uses: 'nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08' # ratchet:nick-fields/retry@v3
33+
with:
34+
timeout_seconds: 900
35+
retry_wait_seconds: 30
36+
max_attempts: 10
37+
command: |-
38+
npm install --prefer-online --no-cache -g ${{ inputs.npm-package }}
39+
40+
# This provides a very basic smoke test for Gemini CLI
41+
- name: 'Run Gemini CLI'
42+
id: 'gemini_cli'
43+
shell: 'bash'
44+
run: |-
45+
echo "gemini_version=$(gemini --version)" >> $GITHUB_OUTPUT
46+
47+
# Force a failure if it doesn't match
48+
- name: 'Fail workflow if version does not match'
49+
if: '${{ steps.gemini_cli.outputs.gemini_version != inputs.expected-version }}'
50+
shell: 'bash'
51+
run: |-
52+
echo '❌ Got ${{ steps.gemini_cli.outputs.gemini_version }} from ${{ inputs.npm-package }}'
53+
echo '❌ Expected Version ${{ inputs.expected-version }}'
54+
55+
exit 1

.github/workflows/release-change-tags.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,11 @@ jobs:
4646
registry-url: 'https://wombat-dressing-room.appspot.com'
4747
scope: '@google'
4848

49-
- name: 'Change tag for @google/gemini-cli-core'
50-
if: |-
51-
${{ github.event.inputs.dry-run == 'false' }}
52-
env:
53-
NODE_AUTH_TOKEN: '${{ secrets.WOMBAT_TOKEN_CORE }}'
54-
run: |
55-
npm dist-tag add @google/gemini-cli-core@${{ github.event.inputs.version }} ${{ github.event.inputs.channel }}
56-
57-
- name: 'Change tag for @google/gemini-cli'
58-
if: |-
59-
${{ github.event.inputs.dry-run == 'false' }}
60-
env:
61-
NODE_AUTH_TOKEN: '${{ secrets.WOMBAT_TOKEN_CLI }}'
62-
run: |
63-
npm dist-tag add @google/gemini-cli@${{ github.event.inputs.version }} ${{ github.event.inputs.channel }}
64-
65-
- name: 'Log dry run'
66-
if: |-
67-
${{ github.event.inputs.dry-run == 'true' }}
68-
run: |
69-
echo "Dry run: Would have added tag '${{ github.event.inputs.channel }}' to version '${{ github.event.inputs.version }}' for @google/gemini-cli and @google/gemini-cli-core."
49+
- name: 'Change tag'
50+
uses: './.github/actions/tag-npm-release'
51+
with:
52+
channel: '${{ github.event.inputs.channel }}'
53+
version: '${{ github.event.inputs.version }}'
54+
dry-run: '${{ github.event.inputs.dry-run }}'
55+
wombat-token-core: '${{ secrets.WOMBAT_TOKEN_CORE }}'
56+
wombat-token-cli: '${{ secrets.WOMBAT_TOKEN_CLI }}'

.github/workflows/release-manual.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ on:
3939

4040
jobs:
4141
release:
42-
runs-on: 'ubuntu-latest'
42+
runs-on: 'self-hosted'
4343
permissions:
4444
contents: 'write'
4545
packages: 'write'
@@ -77,6 +77,7 @@ jobs:
7777
- name: 'Publish Release'
7878
uses: './.github/actions/publish-release'
7979
with:
80+
force-skip-tests: '${{ github.event.inputs.force_skip_tests }}'
8081
release-version: '${{ steps.release_info.outputs.RELEASE_VERSION }}'
8182
release-tag: '${{ github.event.inputs.version }}'
8283
npm-tag: '${{ github.event.inputs.npm_channel }}'
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Verify NPM release tag'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'The expected Gemini binary version that should be released (e.g., 0.5.0-preview-2).'
8+
required: true
9+
type: 'string'
10+
npm-package:
11+
description: 'NPM package to verify'
12+
required: true
13+
type: 'string'
14+
default: '@google/gemini-cli@latest'
15+
ref:
16+
description: 'The branch, tag, or SHA to release from.'
17+
required: false
18+
type: 'string'
19+
default: 'main'
20+
21+
jobs:
22+
build:
23+
runs-on: 'ubuntu-latest'
24+
steps:
25+
- uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8'
26+
- name: 'Verify release'
27+
uses: './.github/actions/verify-release'
28+
with:
29+
npm-package: '${github.event.inputs.npm-package}'
30+
expected-version: '${github.event.inputs.version}'
31+
ref: '${github.event.inputs.ref}'

0 commit comments

Comments
 (0)