mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-07 22:24:06 -05:00
95 lines
3.0 KiB
YAML
95 lines
3.0 KiB
YAML
name: Publish TypeScript SDK
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'packages/ts-sdk/**'
|
|
|
|
jobs:
|
|
publish-npm:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.3
|
|
|
|
- name: Setup Node.js for npm publishing
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
registry-url: 'https://registry.npmjs.org/'
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.bun/install/cache
|
|
node_modules
|
|
**/node_modules
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
working-directory: packages/ts-sdk
|
|
run: bun run test
|
|
|
|
- name: Build package
|
|
working-directory: packages/ts-sdk
|
|
run: bun run build
|
|
|
|
- name: Get package version
|
|
id: package_version
|
|
working-directory: packages/ts-sdk
|
|
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check if version already exists
|
|
id: version_check
|
|
run: |
|
|
if npm view simstudio-ts-sdk@${{ steps.package_version.outputs.version }} version &> /dev/null; then
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Publish to npm
|
|
if: steps.version_check.outputs.exists == 'false'
|
|
working-directory: packages/ts-sdk
|
|
run: npm publish --access=public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Log skipped publish
|
|
if: steps.version_check.outputs.exists == 'true'
|
|
run: echo "Skipped publishing because version ${{ steps.package_version.outputs.version }} already exists on npm"
|
|
|
|
- name: Create GitHub Release
|
|
if: steps.version_check.outputs.exists == 'false'
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: typescript-sdk-v${{ steps.package_version.outputs.version }}
|
|
name: TypeScript SDK v${{ steps.package_version.outputs.version }}
|
|
body: |
|
|
## TypeScript SDK v${{ steps.package_version.outputs.version }}
|
|
|
|
Published simstudio-ts-sdk@${{ steps.package_version.outputs.version }} to npm.
|
|
|
|
### Installation
|
|
```bash
|
|
npm install simstudio-ts-sdk@${{ steps.package_version.outputs.version }}
|
|
```
|
|
|
|
### Documentation
|
|
See the [README](https://github.com/simstudioai/sim/tree/main/packages/ts-sdk) or the [docs](https://docs.sim.ai/sdks/typescript) for more information.
|
|
draft: false
|
|
prerelease: false |