name: Release on: push: tags: - 'v*.*.*' workflow_dispatch: inputs: dry_run: description: 'Whether to run the publish step in dry-run mode.' required: true type: boolean default: true jobs: release: runs-on: ubuntu-latest # Use the current repository name dynamically if: github.repository == 'google-gemini/gemini-cli' permissions: contents: write # Required to create a GitHub release packages: write # Required to publish to GitHub Packages (if you use it) id-token: write # Required for Workload Identity Federation to Google Cloud steps: - name: Checkout code uses: actions/checkout@v4 # Fetch all history for versioning with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install Dependencies run: npm ci - name: Check Version Consistency run: npm run check:versions # - name: Setup Google Cloud SDK # uses: 'google-github-actions/setup-gcloud@v2' # - name: Authenticate to Google Cloud # uses: 'google-github-actions/auth@v2' # with: # workload_identity_provider: 'projects/48735766119/locations/global/workloadIdentityPools/github/providers/github-actions-provider' # service_account: 'gh-actions-service-account@gemini-code-dev.iam.gserviceaccount.com' # - name: Configure Docker # run: gcloud auth configure-docker us-west1-docker.pkg.dev # - name: Login to Artifact Registry # run: docker login -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://us-west1-docker.pkg.dev - name: Set Release Version and Tag id: version run: | RELEASE_VERSION="${GITHUB_REF_NAME#v}" if [[ $RELEASE_VERSION == *-* ]]; then NPM_TAG=$(echo $RELEASE_VERSION | cut -d'-' -f2 | cut -d'.' -f1) else NPM_TAG="latest" fi echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT echo "NPM_TAG=${NPM_TAG}" >> $GITHUB_OUTPUT # Set up Node *again* to update the `.npmrc` config - name: Setup Node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version-file: '.nvmrc' cache: npm registry-url: 'https://wombat-dressing-room.appspot.com' scope: '@google' - name: Build, Prepare, and Publish run: npm run publish:npm env: NPM_PUBLISH_TAG: ${{ steps.version.outputs.NPM_TAG }} NPM_DRY_RUN: ${{ inputs.dry_run && '--dry-run' || '' }} NODE_AUTH_TOKEN: ${{ secrets.WOMBAT_TOKEN }} - name: Create GitHub Release if: steps.run_type.outputs.NPM_DRY_RUN == '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release create v${{ steps.version.outputs.RELEASE_VERSION }} \ --title "Release v${{ steps.version.outputs.RELEASE_VERSION }}" \ --notes "See the [CHANGELOG.md](CHANGELOG.md) for details."