openpencil/.github/workflows/publish-cli.yml
Kayshen-X 22003f9b0c chore(shell-native): add transient P0 probe gate (Step 1a)
Drives the three-OS CI matrix verification of the skia-safe + glutin +
glow + winit dep stack per Step 1a spec §7.

- examples/p0_probe.rs: stencil_visibility + readback chain runner (must
  own a real OS main thread because winit on macOS rejects
  EventLoop::new() from cargo test worker threads).
- tests/p0_probe.rs: subprocess-invoke wrapper, gated
  #[ignore = "P0_PROBE_GATE"] so default cargo test stays untouched.
- Cargo.toml: add transient [target.'cfg(not(target_arch = "wasm32"))'.
  dev-dependencies] block (skia-safe 0.97 + glutin 0.32.3 + glutin-winit
  0.5.0 + glow 0.17.0 + raw-window-handle 0.6.2 + scopeguard 1.2.0 +
  winit defaults). Pinned to versions resolved in /tmp/skia-glow-probe.
- .github/workflows/rust-check.yml: install Linux GL prereqs (xvfb,
  mesa, libxkbcommon, libwayland) and add a P0-probe-gate step running
  cargo test --ignored on each OS (Linux through xvfb-run; Windows
  early-returns per spec §8.2 WINDOWS_GPU_DEFERRED_NO_RUNNER).

All three artefacts are TRANSIENT — reverted in a follow-up cleanup
commit after CI is green and the loader-compat notes commit lands.
Task 1 owns the permanent integration.
2026-05-05 12:23:49 +08:00

116 lines
3.5 KiB
YAML

name: Publish npm
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Install dependencies
env:
OPENPENCIL_SKIP_AGENT_NATIVE: '1'
run: bun install --frozen-lockfile
- name: Get version
id: version
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
- name: Replace workspace:* with version
run: |
VERSION=${{ steps.version.outputs.version }}
for f in packages/*/package.json apps/cli/package.json; do
if [ -f "$f" ]; then
jq --arg v "$VERSION" '
if .dependencies then
.dependencies |= with_entries(
if .value == "workspace:*" then .value = $v else . end
)
else . end |
if .devDependencies then
.devDependencies |= with_entries(
if .value == "workspace:*" then .value = $v else . end
)
else . end
' "$f" > "$f.tmp" && mv "$f.tmp" "$f"
echo "Updated $f"
fi
done
- name: Checkout openpencil-skill
uses: actions/checkout@v4
with:
repository: zseven-w/openpencil-skill
path: external/openpencil-skill
- name: Compile CLI
env:
SKILL_ROOT: ${{ github.workspace }}/external/openpencil-skill
run: bun run cli:compile
- name: Verify CLI build
run: node apps/cli/dist/openpencil-cli.cjs --version
# Publish in topological order. For each package:
# 1. Resolve the real name from its package.json (no hand-written
# name — avoids drift between workflow and package manifest).
# 2. Query the registry for that exact name@version. If it already
# exists, skip (idempotent re-runs of the same tag are safe).
# 3. Otherwise, publish. Real errors (auth, network, notarize, etc.)
# still fail the step because we only skip on a verified hit.
- name: Publish all packages (skip versions already on registry)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
set -euo pipefail
PACKAGES=(
packages/pen-types
packages/pen-core
packages/pen-figma
packages/pen-renderer
packages/pen-engine
packages/pen-react
packages/pen-mcp
packages/pen-sdk
packages/pen-ai-skills
apps/cli
)
for dir in "${PACKAGES[@]}"; do
name=$(jq -r .name "$dir/package.json")
echo "::group::$name@$VERSION ($dir)"
if npm view "$name@$VERSION" version >/dev/null 2>&1; then
echo "✓ already on registry — skipping"
else
( cd "$dir" && npm publish --access public )
echo "✓ published"
fi
echo "::endgroup::"
done