Skip to content

ci(functions-compiler): add a manual npm publish workflow - #631

Merged
yurynix merged 3 commits into
mainfrom
chore/dev3-publish-functions-compiler
Sep 17, 2026
Merged

yurynix merged 3 commits into
mainfrom
chore/dev3-publish-functions-compiler

Conversation

@yurynix

@yurynix yurynix commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Note

Description

Adds a manual npm publish workflow for @base44/functions-compiler so the compiler package can be released independently of the CLI's own release train. The workflow bumps the version, syncs the COMPILER_VERSION literal, builds lib/, publishes to npm via trusted publishing (OIDC — no NPM_TOKEN in the repo), and pushes a functions-compiler-v<version> tag plus release commit. It also fixes the version drift already on main (package.json at 0.1.1, the literal still at 0.1.0) and adds a sync-version.ts script so a release cannot forget the second file again.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe): CI / release automation — no CLI runtime code changes

Changes Made

  • New .github/workflows/functions-compiler-publish.yml (workflow_dispatch with version, npm_tag, dry_run inputs): installs with --frozen-lockfile, bumps with npm version --no-workspaces (so the CLI is not bumped alongside), syncs the version literal, runs bun run build in packages/functions-compiler, publishes, then commits and pushes a functions-compiler-v<version> tag. All actions are SHA-pinned and the job runs under a GitHub App token.
  • Publishes via npm trusted publishing (OIDC, id-token: write) instead of an NPM_TOKEN; the tag/commit step is skipped on dry_run. Compiler releases use functions-compiler-v* to stay clear of the CLI's v* series.
  • Adds packages/functions-compiler/scripts/sync-version.ts: rewrites the COMPILER_VERSION literal in src/version.ts from package.json, and throws (rather than silently no-opping) if the literal can't be found.
  • Fixes the existing drift by bumping src/version.ts to 0.1.1test/version.test.ts asserts the literal matches package.json, so main is currently red on it.
  • Adds repository (with directory: packages/functions-compiler) to the package manifest, which trusted publishing requires to match the publishing repo and which npm uses for provenance linking.
  • Registers the workflow in PUBLISH_WORKFLOWS in .github/scripts/check_wix_proxy_steps.py, exempting it from the mandatory Wix gateway proxy — the gateway cannot carry npm publish, matching the existing exemptions for manual-publish.yml and preview-publish.yml. The workflow header documents the tradeoff (--frozen-lockfile plus bunfig.toml's minimumReleaseAge).
  • Documents the release process in packages/functions-compiler/README.md, including that the trusted publisher is keyed on the workflow filename, and that the tarball proof (scripts/verify-package.ts) still runs in functions-compiler.yml on every push to main — so publish from a commit that went green there.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

  • No new tests: the existing test/version.test.ts already covers the literal/package.json invariant that sync-version.ts maintains, and the bump in src/version.ts is what makes it pass again. A workflow_dispatch publish workflow cannot be exercised from a PR branch — the first run should use dry_run: true to validate the bump/build/pack path.
  • Prerequisite before the first real run: a trusted publisher for @base44/functions-compiler must be registered on npmjs.com against this repo and functions-compiler-publish.yml. The entries for manual-publish.yml / preview-publish.yml do not cover it, and publishing will fail without it.
  • Unlike the CLI, this package is not bundled — esbuild, @deno/loader and zod stay as real runtime dependencies, so nothing is stripped from package.json before publish.
  • docs/ was not updated because this changes release plumbing, not architecture; the package-local README is the documented home for its release process.

🤖 Generated by Claude | 2026-09-17 16:15 UTC | a8420c7

The CLI's manual-publish.yml cannot be reused for @base44/functions-compiler.
Most of it is CLI-specific — standalone binaries, the Homebrew tap, PostHog
sourcemaps, the skills-repo dispatch, the GitHub Release that carries the
tarballs — and every one of those steps would need an `if:` guard on a package
input, in the one job that must not break. The two trains also tag differently:
`v<version>` is the CLI's series, so this one tags `functions-compiler-v<version>`.

Sharing the file would buy nothing anyway. npm trusted publishing keys a
publisher on the repo *and* the workflow filename, so @base44/functions-compiler
needs its own registry entry either way; a separate file makes that entry
narrower — it can publish this package and nothing else.

Two differences from the CLI workflow worth naming:

- Nothing is stripped from package.json before publish. The CLI deletes
  devDependencies because everything is bundled; here esbuild, @deno/loader and
  zod are real runtime dependencies consumers install.
- The job only builds and publishes. The packaging proof that hits the registry
  (scripts/verify-package.ts) stays in functions-compiler.yml, behind the Wix
  gateway, where it runs on every push to main — so this job still resolves
  nothing, which is what its gateway exemption rests on.

Before the first run, a trusted publisher for @base44/functions-compiler must be
registered on npmjs.com against this repo and this filename.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.1.15-pr.631.a8420c7

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.1.15-pr.631.a8420c7"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.15-pr.631.a8420c7"
  }
}

Preview published to npm registry — try new features instantly!

yurynix and others added 2 commits September 17, 2026 19:08
npm's trusted-publisher validation requires package.json's repository URL to
match the GitHub repository the OIDC token comes from. packages/cli already
declares it; this package did not, so the first publish would have failed the
check with nothing in the workflow to explain why.

`directory` points at the package inside the monorepo, which is also what makes
the npm page link to the right subtree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
main has been red since #623 landed: it added src/version.ts pinned to 0.1.0
and the test that guards it, having branched before #628 bumped package.json to
0.1.1. Setting the literal to 0.1.1 is the whole of that fix.

The publish workflow would have reintroduced the drift on every release. `npm
version` rewrites package.json alone, and the literal cannot be read from
package.json at run time — a host that bundles this module ships none beside it
(that is what src/version.ts documents). So a release would have published a
banner naming the previous version and left main red again.

scripts/sync-version.ts rewrites the literal from package.json and throws if it
matches nothing, because a silent no-op sed is precisely the failure being
prevented. The workflow runs it between the bump and the build, and the release
commit now carries both files. Bumping by hand runs the same script.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@yurynix
yurynix merged commit f14c54c into main Sep 17, 2026
15 checks passed
@yurynix
yurynix deleted the chore/dev3-publish-functions-compiler branch September 17, 2026 16:32
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.

2 participants