8db50791d6
GitHub release artifacts become the canonical build output. npm and Homebrew are independent sibling channels — both consume the same GitHub release tarballs; neither depends on the other. Workflow changes (.github/workflows/release.yml): - Trigger is now workflow_dispatch only (maintainer-only, gated by repo write access). Inputs: bump dropdown (patch/minor/major) + dry_run checkbox. - Single job graph orchestrates everything in one run: prepare (bump, PR, merge, tag) → build-web/build-cli → build-bundles (5 platforms) → docker → publish-release → publish-npm + update-homebrew-tap. - The prepare job inlines version bump, optionalDependencies sync, CHANGELOG generation, PR create + squash-merge, and tag push. Replaces what release-pr.sh used to do locally. - Tag-push trigger removed; everything runs from the dispatch flow. New scripts (called by the workflow): - package-cli.sh: builds + esbuild-bundles the CLI for inclusion in release bundles (cli/bin/cli.js + cli/dist/cli.bundle.js + package.json). - package-npm-runtime.sh: generates per-platform @kdlbs/runtime-* npm packages from release bundles. Sets npm os/cpu fields so npm 7+ skips non-matching platforms during npx kandev install. - publish-npm.sh: verifies GitHub assets exist, downloads them, repackages, publishes all 5 @kdlbs/runtime-* packages + main kandev@X.Y.Z. - update-homebrew-tap.sh: clones kdlbs/homebrew-kandev via SSH using the HOMEBREW_TAP_DEPLOY_KEY repo secret, generates Formula/kandev.rb pointing at the GitHub release assets, pushes directly to main. Removed scripts: - release.sh and release-pr.sh — both are redundant with the new workflow. Required CI secrets: - NPM_TOKEN: granular access token with publish access to kandev + @kdlbs/* - HOMEBREW_TAP_DEPLOY_KEY: SSH private key for kdlbs/homebrew-kandev
42 lines
1.5 KiB
Bash
Executable File
42 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the CLI and copy artifacts into dist/kandev/cli/ for inclusion in release bundles.
|
|
#
|
|
# The CLI bundle (dist/cli.bundle.js) is a single-file esbuild output with all Node
|
|
# dependencies inlined. This is required for Homebrew installs where there is no
|
|
# node_modules directory in the Cellar.
|
|
#
|
|
# Output layout inside dist/kandev/cli/:
|
|
# bin/cli.js - Node entrypoint (requires #!/usr/bin/env node shebang + chmod +x)
|
|
# dist/cli.bundle.js - Self-contained bundle with inlined deps (used by Homebrew)
|
|
# package.json - Package metadata (used to read version at runtime)
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
CLI_DIR="$ROOT_DIR/apps/cli"
|
|
OUT_DIR="$ROOT_DIR/dist/kandev/cli"
|
|
|
|
echo "Building CLI for release bundle..."
|
|
|
|
# Build TypeScript
|
|
pnpm -C "$ROOT_DIR/apps" --filter kandev build
|
|
echo " TypeScript build complete"
|
|
|
|
# Bundle with esbuild (inlines tree-kill and all other deps)
|
|
pnpm -C "$ROOT_DIR/apps/cli" bundle
|
|
echo " esbuild bundle complete"
|
|
|
|
# Copy artifacts into dist/kandev/cli/
|
|
rm -rf "$OUT_DIR"
|
|
mkdir -p "$OUT_DIR/bin" "$OUT_DIR/dist"
|
|
|
|
cp "$CLI_DIR/bin/cli.js" "$OUT_DIR/bin/cli.js"
|
|
chmod +x "$OUT_DIR/bin/cli.js"
|
|
|
|
cp "$CLI_DIR/dist/cli.bundle.js" "$OUT_DIR/dist/cli.bundle.js"
|
|
cp "$CLI_DIR/package.json" "$OUT_DIR/package.json"
|
|
|
|
echo "CLI artifacts packaged at $OUT_DIR"
|
|
echo " bin/cli.js (entrypoint, chmod +x)"
|
|
echo " dist/cli.bundle.js (self-contained bundle)"
|
|
echo " package.json"
|