name: Release on: push: tags: - 'v*.*.*' 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 - name: Configure npm for publishing run: | echo "registry=https://wombat-dressing-room.appspot.com/" > .npmrc echo "//wombat-dressing-room.appspot.com/:_authToken=${{ secrets.WOMBAT_TOKEN }}" >> .npmrc - name: Build, Prepare, and Publish run: npm run publish:npm env: NPM_PUBLISH_TAG: ${{ steps.version.outputs.NPM_TAG }} - 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."