Skip to content

Commit 7728465

Browse files
author
SDK Lead
committed
ci: cross-repo publish workflow for @dakera-ai/ai-sdk (DAK-7289)
1 parent d5b7610 commit 7728465

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish @dakera-ai/ai-sdk to npm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'Tag or SHA to publish (e.g. v0.1.1)'
8+
required: true
9+
default: 'main'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
publish:
16+
name: Publish ai-sdk
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- name: Checkout dakera-ai-sdk (public repo)
22+
uses: actions/checkout@v7
23+
with:
24+
repository: dakera-ai/dakera-ai-sdk
25+
ref: ${{ github.event.inputs.ref }}
26+
27+
- name: Set up Node.js
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version: "22"
31+
registry-url: "https://registry.npmjs.org"
32+
33+
- name: Install dependencies
34+
run: npm ci
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Check version
40+
id: check
41+
run: |
42+
PKG_VERSION=$(node -p "require('./package.json').version")
43+
echo "version=${PKG_VERSION}" >> "$GITHUB_OUTPUT"
44+
if npm view "@dakera-ai/ai-sdk@${PKG_VERSION}" version 2>/dev/null | grep -q "${PKG_VERSION}"; then
45+
echo "already=true" >> "$GITHUB_OUTPUT"
46+
echo "v${PKG_VERSION} already on npm — skipping."
47+
else
48+
echo "already=false" >> "$GITHUB_OUTPUT"
49+
echo "v${PKG_VERSION} not on npm — will publish."
50+
fi
51+
52+
- name: Publish to npm
53+
if: steps.check.outputs.already != 'true'
54+
run: npm publish --access=public
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)