chore(sdk): switch to unscoped name chronos-synapse-sdk and bump to 0… #3
Workflow file for this run
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 SDK | |
| on: | |
| push: | |
| tags: | |
| - 'sdk-v*' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| publish: | |
| name: Publish SDK (chronos-synapse-sdk) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: sdk | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4.0.2 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Set package version from tag (skip if same) | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#sdk-v}" | |
| CURRENT=$(node -p "require('./package.json').version") | |
| echo "Version from tag: $VERSION (current: $CURRENT)" | |
| if [ "$CURRENT" != "$VERSION" ]; then | |
| npm version "$VERSION" --no-git-tag-version | |
| else | |
| echo "Version unchanged; skipping bump" | |
| fi | |
| - name: Build | |
| run: npm run build | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |