Skip to content

Commit 1f831f5

Browse files
authored
Merge pull request #5 from roboflow/publish-actin
Publish action to inference-sdk js
2 parents cc61c5b + 868e3af commit 1f831f5

File tree

3 files changed

+91
-4
lines changed

3 files changed

+91
-4
lines changed

.github/workflows/publish.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
# TODO: Remove publish-actin before merging
26+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/publish-actin'
27+
environment: release
28+
permissions:
29+
contents: write
30+
id-token: write
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: '20'
39+
cache: 'npm'
40+
registry-url: 'https://registry.npmjs.org'
41+
42+
- name: Update npm for trusted publishing
43+
run: npm install -g npm@latest
44+
45+
- name: Install dependencies
46+
run: npm ci
47+
48+
- name: Run tests
49+
run: npm run test
50+
51+
- name: Build
52+
run: npm run build
53+
54+
- name: Configure git
55+
run: |
56+
git config user.name "github-actions[bot]"
57+
git config user.email "github-actions[bot]@users.noreply.github.com"
58+
59+
- name: Bump version
60+
run: 'npm version ${{ inputs.version_bump }} -m "chore: release v%s"'
61+
62+
- name: Push version commit and tag
63+
if: ${{ inputs.dry_run == false }}
64+
run: git push --follow-tags
65+
66+
- name: Publish to npm
67+
if: ${{ inputs.dry_run == false }}
68+
# auth works by adding github.com/roboflow/inference-sdk-js as a trusted publisher in https://www.npmjs.com/package/@roboflow/inference-sdk
69+
run: npm publish --access public
70+
71+
- name: Create GitHub Release
72+
if: ${{ inputs.dry_run == false }}
73+
run: |
74+
VERSION=$(node -p "require('./package.json').version")
75+
gh release create "v$VERSION" \
76+
--title "v$VERSION" \
77+
--generate-notes
78+
env:
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Dry run summary
82+
if: ${{ inputs.dry_run == true }}
83+
run: |
84+
echo "🧪 Dry run completed successfully!"
85+
echo "Version would be: $(node -p "require('./package.json').version")"
86+
echo "Package contents:"
87+
npm pack --dry-run

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
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.5",
44
"description": "Lightweight client for Roboflow's hosted inference API with WebRTC streaming support",
55
"keywords": [
66
"roboflow",
@@ -35,7 +35,7 @@
3535
"license": "ISC",
3636
"repository": {
3737
"type": "git",
38-
"url": "https://github.com/roboflow/inference-sdk.git"
38+
"url": "https://github.com/roboflow/inference-sdk-js"
3939
},
4040
"devDependencies": {
4141
"typescript": "^5.3.3",

0 commit comments

Comments
 (0)