Skip to content

Commit a4894cc

Browse files
committed
NPM publish action
1 parent cc61c5b commit a4894cc

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Version bump type'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
dry_run:
16+
description: 'Dry run (skip actual publish)'
17+
required: false
18+
default: false
19+
type: boolean
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
# Only allow publishing from master branch
25+
if: github.ref == 'refs/heads/master'
26+
permissions:
27+
contents: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: '20'
36+
cache: 'npm'
37+
registry-url: 'https://registry.npmjs.org'
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Run tests
43+
run: npm run test
44+
45+
- name: Build
46+
run: npm run build
47+
48+
- name: Configure git
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "github-actions[bot]@users.noreply.github.com"
52+
53+
- name: Bump version
54+
run: npm version ${{ inputs.version_bump }} -m "chore: release v%s"
55+
56+
- name: Push version commit and tag
57+
if: ${{ inputs.dry_run == false }}
58+
run: git push --follow-tags
59+
60+
- name: Publish to npm
61+
if: ${{ inputs.dry_run == false }}
62+
run: npm publish --access public
63+
env:
64+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
66+
- name: Dry run summary
67+
if: ${{ inputs.dry_run == true }}
68+
run: |
69+
echo "🧪 Dry run completed successfully!"
70+
echo "Version would be: $(node -p "require('./package.json').version")"
71+
echo "Package contents:"
72+
npm pack --dry-run

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@roboflow/inference-sdk",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support",
55
"keywords": [
66
"roboflow",

0 commit comments

Comments
 (0)