Repository navigation
chore(deps): update all non-major dependencies #130
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: {} | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Package version (e.g. v0.1.0) | |
| required: false | |
| env: | |
| NODE_VERSION: "24" | |
| jobs: | |
| # Compute the package version once and share it with all jobs that need it | |
| version: | |
| runs-on: &default-runner ubuntu-26.04 | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| npm-tag: ${{ steps.version.outputs.npm-tag }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| registry-url: "https://registry.npmjs.org" | |
| # If a version wasn't explicitly passed as a workflow_dispatch input we | |
| # default to version $(npm pkg get version)-<git-commit-date>-<git-short-sha>, for example | |
| # v0.1.1-20231101115142-1091066df799. | |
| - name: Compute Package Version | |
| id: version | |
| env: | |
| INPUT_VERSION: ${{ inputs.version }} | |
| run: | | |
| if [ -n "${INPUT_VERSION}" ]; then | |
| VERSION="${INPUT_VERSION}" | |
| RELEASE_TYPE="latest" | |
| else | |
| VERSION="v$(npm pkg get version | tr -d '"')-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" | |
| RELEASE_TYPE="next" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Computed version: ${VERSION}" | |
| echo "npm-tag=${RELEASE_TYPE}" >> $GITHUB_OUTPUT | |
| echo "npm-tag: ${RELEASE_TYPE}" | |
| protobuf-check: | |
| runs-on: *default-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Install | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| - run: npm ci | |
| # Update this version when ts-proto in package.json is updated | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| version: "33.4" | |
| - name: Generate Protobuf Files | |
| run: npm run protoc-gen | |
| - name: Check for changes in src | |
| run: | | |
| if [[ -n $(git status --porcelain src) ]]; then | |
| echo "Error: Protobuf generation caused changes in src directory" | |
| echo "Please run 'npm run protoc-gen' locally and commit the changes" | |
| git --no-pager status src | |
| git --no-pager diff src | |
| exit 1 | |
| fi | |
| echo "No changes detected in src directory" | |
| lint: | |
| runs-on: *default-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Install | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| - run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| # npm run build compiles only src, which tsconfig.json excludes tests | |
| # from. Type check the tests too, so that a change to an exported | |
| # signature cannot silently break callers the tests cover. | |
| - name: Typecheck | |
| run: npm run typecheck | |
| # Last, because a step that fails stops the job: a formatting nit should | |
| # not hide a real lint or type error. Run `npm run format` to fix. | |
| - name: Format | |
| run: npm run format:check | |
| test: | |
| runs-on: *default-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Install | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| - run: npm ci | |
| - name: test | |
| run: npm test | |
| build: | |
| runs-on: *default-runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Build | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| - run: npm ci | |
| - run: npm run clean | |
| - run: npm run build | |
| publish: | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| runs-on: *default-runner | |
| needs: | |
| - version | |
| - protobuf-check | |
| - test | |
| - lint | |
| - build | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Setup Node | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | |
| with: | |
| node-version: ${{env.NODE_VERSION}} | |
| registry-url: "https://registry.npmjs.org" | |
| - run: npm ci | |
| - name: Set package version | |
| env: | |
| VERSION: ${{ needs.version.outputs.version }} | |
| INPUT_VERSION: ${{ inputs.version }} | |
| run: | | |
| if [ -z "${INPUT_VERSION}" ]; then | |
| # No explicit version provided, set it to the computed version | |
| npm version "$VERSION" --no-git-tag-version | |
| else | |
| # Explicit version provided, verify it matches package.json | |
| PACKAGE_VERSION="v$(npm pkg get version | tr -d '"')" | |
| if [ "$VERSION" != "$PACKAGE_VERSION" ]; then | |
| echo "Error: Provided version $VERSION does not match package.json version $PACKAGE_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version $VERSION matches package.json, proceeding with publish" | |
| fi | |
| - run: npm run clean | |
| - run: npm run build | |
| - name: Publish to npm | |
| env: | |
| NPM_TAG: ${{ needs.version.outputs.npm-tag }} | |
| run: npm publish --provenance --access public --tag "${NPM_TAG}" |