From a4894cca3333530577b6b8e324d316f3af888f70 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 09:12:26 -0300 Subject: [PATCH 1/9] NPM publish action --- .github/workflows/publish.yml | 72 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b0bed76 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,72 @@ +name: Publish to npm + +on: + workflow_dispatch: + inputs: + version_bump: + description: 'Version bump type' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + dry_run: + description: 'Dry run (skip actual publish)' + required: false + default: false + type: boolean + +jobs: + publish: + runs-on: ubuntu-latest + # Only allow publishing from master branch + if: github.ref == 'refs/heads/master' + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm run test + + - name: Build + run: npm run build + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Bump version + run: npm version ${{ inputs.version_bump }} -m "chore: release v%s" + + - name: Push version commit and tag + if: ${{ inputs.dry_run == false }} + run: git push --follow-tags + + - name: Publish to npm + if: ${{ inputs.dry_run == false }} + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Dry run summary + if: ${{ inputs.dry_run == true }} + run: | + echo "🧪 Dry run completed successfully!" + echo "Version would be: $(node -p "require('./package.json').version")" + echo "Package contents:" + npm pack --dry-run diff --git a/package.json b/package.json index beb9acf..c30f88c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@roboflow/inference-sdk", - "version": "0.1.2", + "version": "0.1.3", "description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support", "keywords": [ "roboflow", From a43e1920e0eb5fcabe956ad657112aa0224c5773 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 09:16:03 -0300 Subject: [PATCH 2/9] adding release and branch permission --- .github/workflows/publish.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b0bed76..43a2c6a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,8 @@ jobs: publish: runs-on: ubuntu-latest # Only allow publishing from master branch - if: github.ref == 'refs/heads/master' + # TODO: Remove publish-actin before merging + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/publish-actin' permissions: contents: write steps: @@ -63,6 +64,16 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create GitHub Release + if: ${{ inputs.dry_run == false }} + run: | + VERSION=$(node -p "require('./package.json').version") + gh release create "v$VERSION" \ + --title "v$VERSION" \ + --generate-notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Dry run summary if: ${{ inputs.dry_run == true }} run: | From b7b45d78cee9dfb728e939d3659d7ce438300b30 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 09:31:20 -0300 Subject: [PATCH 3/9] trusted key --- .github/workflows/publish.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 43a2c6a..55d6d9c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,8 +24,10 @@ jobs: # Only allow publishing from master branch # TODO: Remove publish-actin before merging if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/publish-actin' + environment: release permissions: contents: write + id-token: write steps: - uses: actions/checkout@v4 with: @@ -37,6 +39,9 @@ jobs: cache: 'npm' registry-url: 'https://registry.npmjs.org' + - name: Update npm for trusted publishing + run: npm install -g npm@latest + - name: Install dependencies run: npm ci @@ -61,8 +66,6 @@ jobs: - name: Publish to npm if: ${{ inputs.dry_run == false }} run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create GitHub Release if: ${{ inputs.dry_run == false }} From 981eec8019b3353d0637ac7556400cfe8d369596 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 09:58:07 -0300 Subject: [PATCH 4/9] trusted key --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 55d6d9c..906f97f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: git config user.email "github-actions[bot]@users.noreply.github.com" - name: Bump version - run: npm version ${{ inputs.version_bump }} -m "chore: release v%s" + run: npm version "${{ inputs.version_bump }}" -m "chore: release v%s" - name: Push version commit and tag if: ${{ inputs.dry_run == false }} From 0db62a2ae70c32f33508c51582ede77662ff39ef Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 10:01:08 -0300 Subject: [PATCH 5/9] fix --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 906f97f..790bfbb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: git config user.email "github-actions[bot]@users.noreply.github.com" - name: Bump version - run: npm version "${{ inputs.version_bump }}" -m "chore: release v%s" + run: 'npm version ${{ inputs.version_bump }} -m "chore: release v%s"' - name: Push version commit and tag if: ${{ inputs.dry_run == false }} From 7734e9d51884bbef8c83117012fb3dcdf13c8aa7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 2 Dec 2025 13:05:48 +0000 Subject: [PATCH 6/9] chore: release v0.1.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84c2c8a..e2853fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@roboflow/inference-sdk", - "version": "0.1.0", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@roboflow/inference-sdk", - "version": "0.1.0", + "version": "0.1.4", "license": "ISC", "devDependencies": { "typescript": "^5.3.3", diff --git a/package.json b/package.json index c30f88c..b3d9403 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@roboflow/inference-sdk", - "version": "0.1.3", + "version": "0.1.4", "description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support", "keywords": [ "roboflow", From 1eeeaaa20f60c6f780df78f2537e0ca563b2bae2 Mon Sep 17 00:00:00 2001 From: Rodrigo Barbosa Date: Tue, 2 Dec 2025 10:07:11 -0300 Subject: [PATCH 7/9] git fix url --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3d9403..040f0c8 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "license": "ISC", "repository": { "type": "git", - "url": "https://github.com/roboflow/inference-sdk.git" + "url": "https://github.com/roboflow/inference-sdk-js" }, "devDependencies": { "typescript": "^5.3.3", From 3d4b1a4934556bc24173dab416d1ea82a46d1102 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 2 Dec 2025 13:09:01 +0000 Subject: [PATCH 8/9] chore: release v0.1.5 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2853fa..e931baa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@roboflow/inference-sdk", - "version": "0.1.4", + "version": "0.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@roboflow/inference-sdk", - "version": "0.1.4", + "version": "0.1.5", "license": "ISC", "devDependencies": { "typescript": "^5.3.3", diff --git a/package.json b/package.json index 040f0c8..4b704d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@roboflow/inference-sdk", - "version": "0.1.4", + "version": "0.1.5", "description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support", "keywords": [ "roboflow", From 868e3afdf2bd53bcc4300a7683b795a53308dcea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20L=C3=A2mpada?= <218821+tonylampada@users.noreply.github.com> Date: Tue, 2 Dec 2025 10:55:08 -0300 Subject: [PATCH 9/9] Apply suggestion from @tonylampada --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 790bfbb..a4819e7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -65,6 +65,7 @@ jobs: - name: Publish to npm if: ${{ inputs.dry_run == false }} + # auth works by adding github.com/roboflow/inference-sdk-js as a trusted publisher in https://www.npmjs.com/package/@roboflow/inference-sdk run: npm publish --access public - name: Create GitHub Release