Repository navigation
v0.9.28: mship contract updates, library #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: publish-ts-sdk | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'packages/ts-sdk/**' | |
| permissions: | |
| contents: write | |
| # A newer push waits for the running publish rather than racing its version check. | |
| concurrency: | |
| group: publish-ts-sdk-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| name: publish | |
| runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup workspace | |
| uses: ./.github/actions/setup | |
| with: | |
| provider: ${{ vars.CI_PROVIDER }} | |
| node-version: '22' | |
| registry-url: https://registry.npmjs.org/ | |
| - 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 | |
| env: | |
| VERSION: ${{ steps.package_version.outputs.version }} | |
| run: | | |
| if npm view "simstudio-ts-sdk@$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' | |
| env: | |
| VERSION: ${{ steps.package_version.outputs.version }} | |
| run: echo "Skipped publishing because version $VERSION already exists on npm" | |
| - name: Create GitHub Release | |
| if: steps.version_check.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 | |
| 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 |