fix: Emit room error before cleanup of room on js client (#55) #80
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: release-please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| steps: | |
| - name: Release Please | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| # Use manifest mode with workspace-aware config | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| include-component-in-tag: true | |
| publish: | |
| needs: release | |
| if: ${{ needs.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build all packages | |
| run: pnpm -r build | |
| - name: Publish changed packages to npm | |
| run: | | |
| set -euo pipefail | |
| echo "Finding unpublished workspace packages..." | |
| filters="" | |
| for pkgjson in packages/*/package.json; do | |
| # TODO: REVIEW ensure only public packages under packages/ are considered | |
| name=$(jq -r '.name' "$pkgjson") | |
| version=$(jq -r '.version' "$pkgjson") | |
| private=$(jq -r '(.private // false)' "$pkgjson") | |
| if [ "$private" = "true" ]; then | |
| echo "Skipping private package $name" | |
| continue | |
| fi | |
| if npm view "$name@$version" version > /dev/null 2>&1; then | |
| echo "Already published: $name@$version" | |
| else | |
| echo "Will publish: $name@$version" | |
| filters+=" --filter $name" | |
| fi | |
| done | |
| if [ -z "$filters" ]; then | |
| echo "No unpublished packages detected. Skipping publish." | |
| exit 0 | |
| fi | |
| # Publish only the unpublished ones in topo order | |
| echo "Publishing: $filters" | |
| pnpm -r $filters publish --access public --no-git-checks | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Test Rust loro-protocol crate | |
| working-directory: rust | |
| run: cargo test -p loro-protocol | |
| - name: Publish Rust loro-protocol crate to crates.io | |
| working-directory: rust/loro-protocol | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| name=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name') | |
| version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | |
| if curl -fsSL \ | |
| -H "User-Agent: loro-dev/protocol release workflow" \ | |
| "https://crates.io/api/v1/crates/$name/$version" > /dev/null; then | |
| echo "Already published: $name@$version" | |
| exit 0 | |
| fi | |
| if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then | |
| echo "CARGO_REGISTRY_TOKEN is required to publish $name@$version" | |
| exit 1 | |
| fi | |
| echo "Publishing: $name@$version" | |
| cargo publish |