v0.2.0-rc.3 #1
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: cd | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| name: Publish plugin-sdk-react package | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.2.23" | |
| - name: Cache Bun packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-plugin-sdk-react-${{ hashFiles('bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun-plugin-sdk-react- | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| # Strip the leading 'v' from the release tag (v1.2.3 → 1.2.3) so it | |
| # matches npm's semver format, then stamp package.json without a git tag. | |
| # Must run BEFORE build so the version is baked into build/package.json. | |
| - name: Set package version | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| npm version "${VERSION#v}" --no-git-tag-version | |
| - name: Build | |
| run: bun run build | |
| - name: Setup Node.js with npm registry | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| scope: "@paca-ai" | |
| - name: Upgrade npm | |
| run: npm install -g npm@latest | |
| # For prerelease versions (e.g. 1.0.0-alpha.1), npm requires an explicit | |
| # --tag to avoid accidentally tagging as "latest". | |
| - name: Publish to npm | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| CLEAN_VERSION="${VERSION#v}" | |
| if [[ "$CLEAN_VERSION" == *"-"* ]]; then | |
| PRERELEASE_LABEL=$(echo "$CLEAN_VERSION" | sed 's/[^-]*-\([a-zA-Z]*\).*/\1/') | |
| npm publish --provenance --access public --tag "${PRERELEASE_LABEL:-next}" | |
| else | |
| npm publish --provenance --access public | |
| fi |