Merge pull request #380 from ably/release/v1.0.0 #11
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: npm release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: web-cli-release-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: "write" | |
| id-token: "write" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v5 | |
| with: | |
| version: 10 # Use pnpm version 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| with: | |
| node-version: "22.x" # Use Node.js 22.x | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org/" | |
| # The version check is necessary because the web-cli is published as a separate package from the main CLI | |
| # and we can't guarantee a version bump every time the CLI releases. | |
| - name: Check if version already exists on npm | |
| id: version-check | |
| run: | | |
| cd packages/react-web-cli | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "Package version: $VERSION" | |
| if pnpm view @ably/react-web-cli@$VERSION > /dev/null 2>&1; then | |
| echo "Version $VERSION already exists on npm" | |
| echo "should-publish=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version $VERSION does not exist on npm, proceeding with publish" | |
| echo "should-publish=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install dependencies | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| cd packages/react-web-cli | |
| pnpm install --frozen-lockfile | |
| - name: Publish | |
| if: steps.version-check.outputs.should-publish == 'true' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| cd packages/react-web-cli | |
| pnpm run build | |
| pnpm publish --provenance --access public --no-git-checks | |
| - name: Skip publish - version already exists | |
| if: steps.version-check.outputs.should-publish == 'false' | |
| run: | | |
| echo "Skipping publish because the version already exists on npm" |