mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-19 15:56:48 -07:00
Feat: Implement dynamic versioning and PR-based tagging for CI builds
This commit is contained in:
@@ -4,16 +4,16 @@ name: 'Build and Publish Bundle'
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
tag:
|
||||
description: 'The tag of the published package'
|
||||
value: '${{ jobs.publish-bundle.outputs.tag }}'
|
||||
version:
|
||||
description: 'The version of the published package'
|
||||
value: '${{ jobs.publish-bundle.outputs.version }}'
|
||||
|
||||
jobs:
|
||||
publish-bundle:
|
||||
name: 'Publish Bundle'
|
||||
runs-on: 'gemini-cli-ubuntu-16-core'
|
||||
outputs:
|
||||
tag: '${{ steps.get_tag.outputs.tag }}'
|
||||
version: '${{ steps.version.outputs.version }}'
|
||||
permissions:
|
||||
contents: 'read'
|
||||
packages: 'write'
|
||||
@@ -44,12 +44,18 @@ jobs:
|
||||
- name: 'Bundle'
|
||||
run: 'npm run bundle'
|
||||
|
||||
- name: 'Get tag'
|
||||
id: 'get_tag'
|
||||
shell: 'bash'
|
||||
env:
|
||||
SHA: 'ci-${{ github.sha }}'
|
||||
run: 'echo "tag=$SHA" >> $GITHUB_OUTPUT'
|
||||
- name: 'Set CI Version'
|
||||
id: 'version'
|
||||
run: |
|
||||
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||
NEW_VERSION="${CURRENT_VERSION}-ci.${{ github.run_number }}.${{ github.sha }}"
|
||||
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
|
||||
npm version --no-git-tag-version "${NEW_VERSION}"
|
||||
|
||||
- name: 'Publish to GitHub Packages'
|
||||
run: 'npm publish --tag="${{ steps.get_tag.outputs.tag }}"'
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
npm publish --tag="pr-${{ github.event.pull_request.number }}"
|
||||
else
|
||||
npm publish --tag="ci"
|
||||
fi
|
||||
|
||||
@@ -3,8 +3,8 @@ name: 'Testing: CI'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'The tag of the published package'
|
||||
version:
|
||||
description: 'The version of the published package'
|
||||
required: true
|
||||
type: 'string'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'The tag of the published package'
|
||||
version:
|
||||
description: 'The version of the published package'
|
||||
required: true
|
||||
type: 'string'
|
||||
|
||||
@@ -58,18 +58,8 @@ jobs:
|
||||
with:
|
||||
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
|
||||
|
||||
- name: 'Set up Node.js ${{ matrix.node-version }}'
|
||||
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions-node@v4
|
||||
with:
|
||||
node-version: '${{ matrix.node-version }}'
|
||||
|
||||
- name: 'Configure npm for GitHub Packages'
|
||||
run: |
|
||||
echo "@google-gemini:registry=https://npm.pkg.github.com/" > .npmrc
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||
|
||||
- name: 'Install dependencies'
|
||||
run: 'npm install @google-gemini/gemini-cli@${{ inputs.tag }}'
|
||||
run: 'npm install @google-gemini/gemini-cli@${{ inputs.version }}'
|
||||
|
||||
- name: 'Set up Docker'
|
||||
if: "matrix.sandbox == 'sandbox:docker'"
|
||||
|
||||
@@ -35,11 +35,11 @@ jobs:
|
||||
needs: 'build-and-publish'
|
||||
uses: './.github/workflows/ci.yml'
|
||||
with:
|
||||
tag: '${{ needs.build-and-publish.outputs.tag }}'
|
||||
version: '${{ needs.build-and-publish.outputs.version }}'
|
||||
|
||||
e2e:
|
||||
name: 'E2E Checks'
|
||||
needs: 'build-and-publish'
|
||||
uses: './.github/workflows/e2e.yml'
|
||||
with:
|
||||
tag: '${{ needs.build-and-publish.outputs.tag }}'
|
||||
version: '${{ needs.build-and-publish.outputs.version }}'
|
||||
|
||||
Reference in New Issue
Block a user