feat(ci): add ability to publish packages to private github registry for testing (#10348)

This commit is contained in:
Shreya Keshive
2025-10-03 11:41:32 -04:00
committed by GitHub
parent d8570e4d64
commit 667ca6d241
3 changed files with 133 additions and 16 deletions

View File

@@ -48,7 +48,10 @@ inputs:
gemini_api_key:
description: 'The API key for running integration tests.'
required: true
registry:
description: 'The registry to publish to.'
required: false
default: 'npm-wombat'
runs:
using: 'composite'
steps:
@@ -103,14 +106,37 @@ runs:
npm run build:packages
npm run prepare:package
- name: 'Configure npm for publishing'
- name: '🎁 Bundle'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
run: |
npm run bundle
- name: '📦 Prepare for GitHub release'
if: "inputs.registry == 'github'"
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
run: |
node ${{ github.workspace }}/scripts/prepare-github-release.js
- name: 'Configure npm for publishing to npm'
if: "inputs.registry != 'github'"
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020'
with:
node-version-file: '${{ inputs.working-directory }}/.nvmrc'
registry-url: 'https://wombat-dressing-room.appspot.com'
scope: '@google'
- name: '📦 Publish @google/gemini-cli-core'
- name: 'Configure npm for publishing to GitHub'
if: "inputs.registry == 'github'"
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020'
with:
node-version-file: '${{ inputs.working-directory }}/.nvmrc'
registry-url: 'https://npm.pkg.github.com'
scope: '@google-gemini'
- name: '📦 Publish @google/gemini-cli-core to npm'
if: "inputs.registry != 'github'"
working-directory: '${{ inputs.working-directory }}'
env:
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-core }}'
@@ -122,16 +148,29 @@ runs:
npm publish --workspace="@google/gemini-cli-core" --no-tag
fi
- name: '📦 Publish @google-gemini/gemini-cli-core to GitHub'
if: "inputs.registry == 'github'"
working-directory: '${{ inputs.working-directory }}'
env:
NODE_AUTH_TOKEN: '${{ inputs.github-token }}'
shell: 'bash'
run: |
npm publish \
--dry-run="${{ inputs.dry-run }}" \
--workspace="@google-gemini/gemini-cli-core" \
--no-tag
- name: '🔗 Install latest core package'
working-directory: '${{ inputs.working-directory }}'
if: "${{ inputs.dry-run != 'true' }}"
if: "${{ inputs.dry-run != 'true' && inputs.registry != 'github' }}"
shell: 'bash'
run: |
npm install "@google/gemini-cli-core@${{ inputs.release-version }}" \
--workspace="@google/gemini-cli" \
--save-exact
- name: '📦 Publish @google/gemini-cli'
- name: '📦 Publish @google/gemini-cli to npm'
if: "inputs.registry != 'github'"
working-directory: '${{ inputs.working-directory }}'
env:
NODE_AUTH_TOKEN: '${{ inputs.wombat-token-cli }}'
@@ -143,9 +182,21 @@ runs:
npm publish --workspace="@google/gemini-cli" --no-tag
fi
- name: '📦 Publish @google-gemini/gemini-cli to GitHub'
if: "inputs.registry == 'github'"
working-directory: '${{ inputs.working-directory }}'
env:
NODE_AUTH_TOKEN: '${{ inputs.github-token }}'
shell: 'bash'
run: |
npm publish \
--dry-run="${{ inputs.dry-run }}" \
--workspace="@google-gemini/gemini-cli" \
--no-tag
- name: '🔬 Verify NPM release by version'
uses: './.github/actions/verify-release'
if: "${{ inputs.dry-run != 'true' && inputs.force-skip-tests != 'true' }}"
if: "${{ inputs.dry-run != 'true' && inputs.force-skip-tests != 'true' && inputs.registry != 'github' }}"
with:
npm-package: '@google/gemini-cli@${{ inputs.release-version }}'
expected-version: '${{ inputs.release-version }}'
@@ -154,7 +205,7 @@ runs:
- name: '🏷️ Tag release'
uses: './.github/actions/tag-npm-release'
if: "${{ inputs.dry-run != 'true' }}"
if: "${{ inputs.dry-run != 'true' && inputs.registry != 'github' }}"
with:
channel: '${{ inputs.npm-tag }}'
version: '${{ inputs.release-version }}'
@@ -162,15 +213,9 @@ runs:
wombat-token-core: '${{ inputs.wombat-token-core }}'
wombat-token-cli: '${{ inputs.wombat-token-cli }}'
- name: '🎁 Bundle'
working-directory: '${{ inputs.working-directory }}'
shell: 'bash'
run: |
npm run bundle
- name: '🎉 Create GitHub Release'
working-directory: '${{ inputs.working-directory }}'
if: "${{ inputs.dry-run != 'true' && inputs.skip-github-release != 'true' && inputs.npm-tag != 'dev' }}"
if: "${{ inputs.dry-run != 'true' && inputs.skip-github-release != 'true' && inputs.npm-tag != 'dev' && inputs.registry != 'github' }}"
env:
GITHUB_TOKEN: '${{ inputs.github-token }}'
shell: 'bash'

View File

@@ -11,8 +11,16 @@ on:
description: 'The branch, tag, or SHA to release from.'
required: true
type: 'string'
registry:
description: 'The registry to publish to.'
required: true
type: 'choice'
options:
- 'npm-wombat'
- 'github'
default: 'npm-wombat'
npm_channel:
description: 'The npm channel to publish to.'
description: 'The npm channel to publish to (only used when registry is npm-wombat)'
required: true
type: 'choice'
options:
@@ -32,7 +40,7 @@ on:
type: 'boolean'
default: false
skip_github_release:
description: 'Select to skip creating a GitHub release and create a npm release only.'
description: 'Select to skip creating a GitHub release (only used when registry is npm-wombat)'
required: false
type: 'boolean'
default: false
@@ -100,6 +108,7 @@ jobs:
skip-github-release: '${{ github.event.inputs.skip_github_release }}'
working-directory: './release'
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
registry: '${{ github.event.inputs.registry }}'
- name: 'Create Issue on Failure'
if: '${{ failure() && github.event.inputs.dry_run == false }}'