Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Canary Release

# Publishes a preview build of @raystack/apsara to pkg.pr.new on every push
# to a pull request or to main, so changes can be installed and tested
# before a real npm release. See https://pkg.pr.new
on:
pull_request:
branches: [main]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
push:
branches: [main]

permissions: {}

# --comment=update edits a single comment per PR; cancel superseded runs so a
# stale run can't finish after a newer one and leave outdated info behind.
concurrency:
group: canary-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
name: Publish to pkg.pr.new
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup pnpm 9
uses: pnpm/action-setup@v4
with:
version: 9.3.0

- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "pnpm"

- name: Install Dependencies 🔧
run: pnpm install --frozen-lockfile

- name: Build Step 🔧
run: pnpm build:apsara

- name: Publish 🚀
run: pnpm exec pkg-pr-new publish ./packages/raystack --comment=update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow line =="
cat -n .github/workflows/canary.yaml | sed -n '35,45p'

echo
echo "== pkg.pr.new related docs/config =="
rg -n "pkg\.pr\.new|pkg-pr-new|--commentWithSha|--packageManager|commentWithSha|packageManager" -S .github README.md packages 2>/dev/null || true

echo
echo "== package manager/package info =="
for f in package.json pnpm-workspace.yaml pnpm-lock.yaml; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    sed -n '1,120p' "$f"
  fi
done

Repository: raystack/apsara

Length of output: 6132


🌐 Web query:

pkg.pr.new packageManager commentWithSha npm install snippets PR-number URLs defaults

💡 Result:

pkg.pr.new is a tool for creating continuous, npm-compatible preview releases directly from your GitHub pull requests and commits without publishing to the npm registry [1][2]. Below are the details regarding the configuration flags you inquired about: --commentWithSha This flag controls the format of the installation URLs generated in the GitHub comments posted by the bot [3]. - When set to true, the bot uses the commit SHA instead of the pull request number in the generated install commands (e.g., npm i https://pkg.pr.new/package@a832a55) [3]. - When set to false (default), it uses the pull request number (e.g., npm i https://pkg.pr.new/package@123), which can sometimes lead to caching issues because the URL remains the same for different commits within the same PR [4][3]. --packageManager=XYZ This flag allows you to customize the package manager syntax reflected in the bot's comments [1][3]. - Supported values for XYZ are: npm (default), pnpm, yarn, or bun [1][5]. - You can provide multiple comma-separated values (e.g., --packageManager=npm,pnpm) to show snippets for different package managers simultaneously [1][2]. Additional Context: - Usage: These flags are typically passed to the pkg-pr-new command in your GitHub Actions workflows (e.g., pnpm exec pkg-pr-new publish --commentWithSha --packageManager=npm,pnpm) [6][1][5]. - Defaults: By default, the tool uses npm as the package manager and includes the pull request number in the comment links [5][3]. - Other Flags: The tool also offers --bin (to show npx execute commands instead of install commands for CLI apps) and --no-compact (to force long-form URLs) [1][2][5]. For more control, you can use --comment=off in combination with the --json flag to generate metadata and create your own custom GitHub comments via the GitHub Actions API [2][7].

Citations:


Publish pkg.pr.new previews for the pnpm workspace.

pnpm exec pkg-pr-new publish ./packages/raystack publishes the workspace package source rather than a built package, which can produce install commands that do not resolve correctly. Publish packages/raystack after the build step, or use the built artifact path.

🧰 Tools
🪛 zizmor (1.28.0)

[info] 41-41: prefer trusted publishing for authentication (use-trusted-publishing): this command

(use-trusted-publishing)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/canary.yaml at line 41, Update the pkg-pr-new publish step
in the canary workflow to publish the built packages/raystack artifact rather
than the workspace source. Ensure this step runs after the build step so
generated outputs are available, while preserving the existing preview comment
behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the --packageManager=pnpm flag to shown pnpm in the generated comments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think we should use --previewVersion

Use --previewVersion to rewrite every published package's version to 0.0.0-preview- before packing (working tree is restored afterward):

pnpm exec pkg-pr-new publish --previewVersion './packages/*'
For example, 1.0.0 becomes 0.0.0-preview-a832a55. The 0.0.0- prefix cannot satisfy a normal semver range for a real release, so lockfile collisions with npm versions are avoided.

From their docs^

24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Thank you for your interest in contributing to Apsara! This guide will help you
- [For Maintainers](#for-maintainers)
- [Release Workflow Details](#release-workflow-details)
- [NPM Publishing](#npm-publishing)
- [Canary Releases](#canary-releases)
- [Getting Help](#getting-help)
- [Code of Conduct](#code-of-conduct)

Expand Down Expand Up @@ -213,6 +214,11 @@ Apsara follows an automated release process using GitHub Actions and semantic ve
- Published to NPM with `next` tag
- Triggered by pushing tags matching `v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+`

3. **Canary Releases**:
- Built automatically for every pull request and every push to `main`
- Not published to NPM — hosted by [pkg.pr.new](https://pkg.pr.new) instead
- No tag or version bump needed

### Creating a Release

#### For Maintainers
Expand Down Expand Up @@ -269,6 +275,24 @@ npm install @raystack/apsara
pnpm add @raystack/apsara
```

### Canary Releases

Every pull request gets a preview build of `@raystack/apsara`, so you can try out changes before they're merged or released — no need to wait for a real NPM publish.

The [`canary.yaml`](.github/workflows/canary.yaml) workflow builds the package and publishes it to [pkg.pr.new](https://pkg.pr.new) on every push to a PR or to `main`. pkg.pr.new then comments on the PR with an install command, for example:

```bash
npm i https://pkg.pr.new/raystack/apsara/@raystack/apsara@<pr-number>
```
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Install that in a test project to check out the change. The preview build updates automatically as new commits are pushed to the same PR.

Pushes to `main` are published the same way but don't have a PR to comment on. Install those directly using the commit SHA:

```bash
npm i https://pkg.pr.new/raystack/apsara/@raystack/apsara@<commit-sha>
```

## Getting Help

If you encounter issues:
Expand Down
8 changes: 8 additions & 0 deletions apps/www/src/content/docs/(overview)/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Install the package using your preferred package manager:
@raystack/apsara
```

### Try a preview build

Every pull request on [GitHub](https://github.com/raystack/apsara) gets a canary build, published automatically via [pkg.pr.new](https://pkg.pr.new). This lets you try out unreleased changes before they ship to npm. The PR will have a comment with an install command, for example:

```bash
npm i https://pkg.pr.new/raystack/apsara/@raystack/apsara@<pr-number>
```

## Setup

### 1. Import styles
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@turbo/gen": "^1.9.7",
"concurrently": "^9.1.2",
"lefthook": "^1.11.12",
"pkg-pr-new": "^0.0.86",
"process": "^0.11.10",
"turbo": "2.3.1",
"typescript": "4.7"
Expand Down
1 change: 1 addition & 0 deletions packages/raystack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![npm version](https://img.shields.io/npm/v/@raystack/apsara?logo=npm&color=cb3837)](https://www.npmjs.com/package/@raystack/apsara)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache)](LICENSE)
[![Biome](https://img.shields.io/badge/Biome-60a5fa?logo=biome&logoColor=white)](https://biomejs.dev/)
[![pkg.pr.new](https://pkg.pr.new/badge/raystack/apsara)](https://pkg.pr.new/~/raystack/apsara)

Apsara is an open-source React component library for building accessible, data-heavy interfaces. It is built on [Base UI](https://base-ui.com/) primitives and written in TypeScript.

Expand Down
5 changes: 5 additions & 0 deletions packages/raystack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
],
"author": "",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/raystack/apsara.git",
"directory": "packages/raystack"
},
"devDependencies": {
"@figma/code-connect": "^1.4.7",
"@raystack/tools-config": "workspace:*",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading