File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 }}
You can’t perform that action at this time.
0 commit comments