Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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
# 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:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v4
with:
node-version: '20'
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

- 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 }}
# 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
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: |
echo "🧪 Dry run completed successfully!"
echo "Version would be: $(node -p "require('./package.json').version")"
echo "Package contents:"
npm pack --dry-run
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roboflow/inference-sdk",
"version": "0.1.2",
"version": "0.1.5",
"description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support",
"keywords": [
"roboflow",
Expand Down Expand Up @@ -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",
Expand Down