fix: coverage check (#8358) #2824
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.changeset/**' | |
| - '**/package.json' | |
| - 'typescript/**' | |
| - '!typescript/infra/**' | |
| - '!typescript/ccip-server/**' | |
| - '!typescript/eslint-config/**' | |
| - '!typescript/github-proxy/**' | |
| - '!typescript/http-registry-server/**' | |
| - '!typescript/tsconfig/**' | |
| - 'solidity/**' | |
| - 'starknet/**' | |
| - 'pnpm-lock.yaml' | |
| - '.github/workflows/release.yml' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| env: | |
| LOG_FORMAT: PRETTY | |
| TURBO_TELEMETRY_DISABLED: 1 | |
| TURBO_API: https://cache.depot.dev | |
| TURBO_TOKEN: ${{ secrets.DEPOT_TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.DEPOT_ORG_ID }} | |
| jobs: | |
| # This job prepares the release by creating or updating a release PR. | |
| # Notice the omission of the `publish` flag in the changesets action. | |
| prepare-release: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| runs-on: depot-ubuntu-24.04 | |
| steps: | |
| # Generate GitHub App token first. | |
| # Used by checkout fetch + changesets/action (via GITHUB_TOKEN) for release PR auth. | |
| - name: Generate GitHub App Token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.HYPER_GONK_APP_ID }} | |
| private-key: ${{ secrets.HYPER_GONK_PRIVATE_KEY }} | |
| - name: Checkout Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| # check out full history | |
| fetch-depth: 0 | |
| submodules: recursive | |
| persist-credentials: false | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Get GitHub App User ID | |
| id: get-user-id | |
| run: echo "user-id=$(gh api /users/${{ steps.generate-token.outputs.app-slug }}[bot] --jq .id)" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| - name: Configure Git for Hyper Gonk | |
| run: | | |
| git config user.name "${{ steps.generate-token.outputs.app-slug }}[bot]" | |
| git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate-token.outputs.app-slug }}[bot]@users.noreply.github.com" | |
| - name: Create Release PR | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: 'chore: release npm packages' | |
| version: pnpm version:prepare | |
| setupGitUser: false | |
| env: | |
| NPM_CONFIG_PROVENANCE: true | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| check-latest-published: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| all_latest: ${{ steps.check.outputs.all_latest }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Retrieve package versions | |
| id: pkg | |
| run: | | |
| find . -name 'package.json' -print0 | while IFS= read -r -d '' pkg; do | |
| jq -r 'select(.private != true) | .name + "@" + .version' "$pkg" | |
| done | tee versions.txt | |
| - name: Compare package versions | |
| id: check | |
| run: | | |
| all_latest=true | |
| while read -r pkg; do | |
| echo "Checking if $pkg is published..." | |
| exists=$(npm view "$pkg" version 2>/dev/null || echo "N/A") | |
| echo "npm returned: $exists" | |
| if [ "$exists" = "N/A" ]; then | |
| echo "$pkg is NOT published." | |
| all_latest=false | |
| break | |
| else | |
| echo "$pkg is published." | |
| fi | |
| done < versions.txt | |
| echo "all_latest=$all_latest" >> $GITHUB_OUTPUT | |
| # If we detect that not all packages are published, we run the | |
| # cli-install-test workflow to verify that the CLI installs correctly. | |
| # Windows is excluded here for speed but tested nightly via cli-install-test.yml. | |
| cli-install-cross-platform-release-test: | |
| needs: [check-latest-published] | |
| if: needs.check-latest-published.outputs.all_latest == 'false' | |
| uses: ./.github/workflows/cli-install-test.yml | |
| with: | |
| include-windows: false | |
| # This job publishes the release to NPM. | |
| publish-release: | |
| needs: cli-install-cross-platform-release-test | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Generate GitHub App token first. | |
| # Used by checkout fetch + changesets/action (via GITHUB_TOKEN) for publish auth. | |
| - name: Generate GitHub App Token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.HYPER_GONK_APP_ID }} | |
| private-key: ${{ secrets.HYPER_GONK_PRIVATE_KEY }} | |
| - name: Checkout Repo | |
| uses: actions/checkout@v6 | |
| with: | |
| # check out full history | |
| fetch-depth: 0 | |
| submodules: recursive | |
| persist-credentials: false | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Setup Foundry | |
| uses: ./.github/actions/setup-foundry | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Get GitHub App User ID | |
| id: get-user-id | |
| run: echo "user-id=$(gh api /users/${{ steps.generate-token.outputs.app-slug }}[bot] --jq .id)" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| - name: Configure Git for Hyper Gonk | |
| run: | | |
| git config user.name "${{ steps.generate-token.outputs.app-slug }}[bot]" | |
| git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate-token.outputs.app-slug }}[bot]@users.noreply.github.com" | |
| - name: Publish Release to NPM | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: 'chore: release npm packages' | |
| version: pnpm version:prepare | |
| publish: pnpm release | |
| setupGitUser: false | |
| env: | |
| NPM_CONFIG_PROVENANCE: true | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |