Skip to content

ci: publish preview packages to pkg.pr.new#1526

Draft
Boshen wants to merge 4 commits intomainfrom
ci/pkg-pr-new
Draft

ci: publish preview packages to pkg.pr.new#1526
Boshen wants to merge 4 commits intomainfrom
ci/pkg-pr-new

Conversation

@Boshen
Copy link
Copy Markdown
Member

@Boshen Boshen commented May 7, 2026

Summary

  • New publish-to-pkg.pr.new.yml workflow: triggered by workflow_dispatch or by adding the pkg.pr.new label on a PR. Computes a snapshot version (0.0.0-pkg-pr-new.<sha>), builds via the reusable workflow, and publishes the CLI/core/test packages plus per-platform NAPI bindings and Rust CLI binary packages to pkg.pr.new.
  • New reusable-release-build.yml: extracts the 8-target build matrix (apple-darwin × {x86_64,aarch64}, unknown-linux-{gnu,musl} × {x86_64,aarch64}, pc-windows-msvc × {x86_64,aarch64}) shared between release.yml and the new pkg.pr.new flow. Takes version and cache-key inputs (caller-distinct cache keys avoid cross-workflow pollution).
  • release.yml: build job collapsed to a uses: of the reusable workflow.
  • packages/cli/publish-native-addons.ts: gated the npm publish calls and the cli-npm cleanup behind SKIP_NPM_PUBLISH=true so the pkg.pr.new flow can reuse the same prep script and leave packages/cli/{npm,cli-npm}/* on disk for pkg-pr-new to pick up.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 215caba
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69fc9d267273e40008f0d00a
😎 Deploy Preview https://deploy-preview-1526--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +167 to +172
pnpm dlx pkg-pr-new publish --compact --pnpm \
'./packages/cli/npm/*' \
'./packages/cli/cli-npm/*' \
'./packages/cli' \
'./packages/core' \
'./packages/test'
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d109e3287

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +42 to +43
if (existsSync(rustCliArtifactsDir)) {
for (const dir of await readdir(rustCliArtifactsDir)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate Rust CLI artifacts before continuing publish

This new existsSync(rustCliArtifactsDir) guard makes artifact import optional, and the script later only warns/continues when binaries are missing, so a release can now succeed while publishing none of the @voidzero-dev/vite-plus-cli-* packages if artifact download fails or is empty. The previous release.yml logic explicitly failed when no vp* binaries were found; that safety check was effectively removed by moving this logic here without a hard failure path.

Useful? React with 👍 / 👎.

Comment on lines +27 to +30
if (mode !== 'npm' && mode !== 'pkg-pr-new') {
console.error(`Usage: publish-native-addons.ts --mode <npm|pkg-pr-new>`);
process.exit(1);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep publish-native usable without mandatory mode flag

This change makes --mode required and exits otherwise, but packages/cli/package.json still defines "publish-native": "node ./publish-native-addons.ts" with no arguments. As a result, the existing script command now fails immediately with the usage error, which breaks manual or automation paths that relied on the preexisting invocation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3820a1c69f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if: >-
github.repository == 'voidzero-dev/vite-plus' &&
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'pkg.pr.new')))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate labeled trigger to the pkg.pr.new label

In .github/workflows/publish-to-pkg.pr.new.yml, the workflow listens to pull_request types: [labeled] but the job condition checks contains(github.event.pull_request.labels.*.name, 'pkg.pr.new'); this becomes true for any later label event once pkg.pr.new is already present, so adding unrelated labels will re-run the full build/publish flow and create duplicate preview publishes/comments. Restrict the pull-request branch of this condition to the actual event label (for example github.event.label.name == 'pkg.pr.new') to avoid unintended reruns.

Useful? React with 👍 / 👎.

@Boshen Boshen marked this pull request as draft May 7, 2026 10:02
Boshen and others added 3 commits May 7, 2026 19:42
Adds a labeled-PR workflow that publishes preview packages to pkg.pr.new,
and extracts the release build matrix into a reusable workflow shared with
the existing npm release flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulls the move-binaries / version-stamp / build-test logic out of inline
YAML and into the existing publish-native-addons.ts. Replaces the
SKIP_NPM_PUBLISH env hack with a --mode {npm,pkg-pr-new} flag. Each
publish workflow is now: download artifacts → run script → publish.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented May 7, 2026

flaky snap tests was fixed in #1528

- Add persist-credentials: false to the prepare-job checkout (artipacked).
- Replace ${{ inputs.* }} / ${{ env.* }} interpolation in run blocks with
  shell env-var expansion to avoid template-injection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants