Merge pull request #954 from ClickHouse/main #6
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: "publish: client-common" | |
| # Publish + release for @clickhouse/client-common (DEPRECATED). | |
| # | |
| # This package is deprecated and effectively frozen: @clickhouse/client and | |
| # @clickhouse/client-web no longer depend on the published package — they build | |
| # the common sources straight from packages/client-common/src via their | |
| # src/common symlinks. It can still be cut a final standalone release. | |
| # | |
| # Split out of the former all-in-one publish.yml so each client package | |
| # publishes on its own. Two triggers, like the standalone-package workflows: | |
| # - push to `release` -> publishes the "head" pre-release tag (internal beta). | |
| # - manual workflow_dispatch -> publishes the "latest" tag and pushes the | |
| # release git tag. The `main` branch never publishes. | |
| # Both use npm OIDC authentication with provenance, and both deploy through the | |
| # protected `npm-publish` environment (release branch only + manual approval). | |
| # | |
| # The push trigger is path-scoped to this package's own sources plus the | |
| # repo-root files its published tarball depends on. | |
| permissions: | |
| contents: read | |
| id-token: write # Required for npm OIDC authentication and provenance | |
| concurrency: | |
| # event_name separates the head (push) and latest (workflow_dispatch) runs so | |
| # a manual publish never cancels an in-progress head publish (or vice versa). | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| # for the latest workflow | |
| workflow_dispatch: | |
| # for the head workflow | |
| push: | |
| branches: | |
| - release | |
| paths: | |
| - "packages/client-common/**" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "tsconfig.base.json" | |
| - "README.md" | |
| - "LICENSE" | |
| - ".github/workflows/publish-client-common.yml" | |
| env: | |
| # Network resilience: npm's default of 2 fetch retries is not enough for | |
| # the transient registry errors (ECONNRESET) we regularly hit in CI. | |
| NPM_CONFIG_FETCH_RETRIES: "5" | |
| NPM_CONFIG_FETCH_RETRY_MINTIMEOUT: "10000" | |
| NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT: "60000" | |
| NPM_CONFIG_FETCH_TIMEOUT: "600000" | |
| jobs: | |
| publish: | |
| name: "Publish @clickhouse/client-common (deprecated)" | |
| if: github.ref == 'refs/heads/release' && github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| environment: npm-publish | |
| permissions: | |
| contents: write # Required to push the release git tag | |
| id-token: write # Required for npm OIDC authentication and provenance | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| packages: "@clickhouse/client-common" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Get the release version | |
| id: version | |
| run: | | |
| BASE_VERSION=$(node -p "require('./packages/client-common/package.json').version") | |
| echo "Using version: $BASE_VERSION" | |
| echo "version=$BASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build the package | |
| run: npm --workspace @clickhouse/client-common run build | |
| - name: Publish @clickhouse/client-common to the latest tag (implicit) | |
| run: | | |
| npm --workspace @clickhouse/client-common publish \ | |
| --access public \ | |
| --provenance | |
| - name: Create and push release git tag | |
| env: | |
| RELEASE_VERSION: ${{ steps.version.outputs.version }} | |
| run: .scripts/push_release_tag.sh "client-common-${RELEASE_VERSION}" |