From 30ba0186b590c6b2ea20c9b9a1794ccfd753fe17 Mon Sep 17 00:00:00 2001 From: Pranav Bobde Date: Wed, 28 Oct 2026 15:22:16 +0530 Subject: [PATCH] ci: build on Node 20 and publish releases from tags - CI: Node 14 (end of life since 2023) -> Node 20, actions v4, npm ci with the existing lockfile. - Release: builds on #114. Adds registry-url so setup-node writes the npm auth config (without it NODE_AUTH_TOKEN is ignored and publish fails), and takes the version from the release tag so npm always matches a tagged commit. - package.json: 2.0.2 -> 2.0.10, the version already on npm (published from a063214). --- .github/workflows/ci.yml | 18 +++++---------- .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++++++ package-lock.json | 2 +- package.json | 2 +- 4 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34c1092..3a87765 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,32 +4,26 @@ on: [pull_request] jobs: run-ci: - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run Type Check & Linters runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 20 + cache: npm - name: Install Dependencies - uses: borales/actions-yarn@v2.1.0 - with: - cmd: install + run: npm ci - name: Build Project - uses: borales/actions-yarn@v2.1.0 - with: - cmd: build + run: npm run build - name: Check commits messages uses: wagoid/commitlint-github-action@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7645756 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Publish to npm + +# Publishes @keploy/sdk when a GitHub release is published. +# The release tag (e.g. v2.0.11) sets the package version, so the version on npm +# always matches a tagged commit on main. +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + # Without registry-url, setup-node writes no npm auth config and NODE_AUTH_TOKEN is ignored. + registry-url: https://registry.npmjs.org + + - name: Set version from the release tag + run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version --allow-same-version + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --provenance --access public diff --git a/package-lock.json b/package-lock.json index 411c3ef..08c4924 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@keploy/sdk", - "version": "2.0.2", + "version": "2.0.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8fccf7a..98cdf94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@keploy/sdk", - "version": "2.0.2", + "version": "2.0.10", "description": "This is the client SDK for the [Keploy](https://github.com/keploy/keploy) testing platform. With the TypeScript SDK, you can test both your existing unit test cases in Jest and create new end-to-end test cases for your applications.", "main": "dist/keployCli.js", "types": "dist/keployCli.d.ts",