Skip to content

ci: publish @flatfilers/alchemy to GitHub Packages - #15

Open
agustiobvious wants to merge 2 commits into
mainfrom
feat/publish-package-ghcr
Open

agustiobvious wants to merge 2 commits into
mainfrom
feat/publish-package-ghcr

Conversation

@agustiobvious

Copy link
Copy Markdown

Lets internal consumers depend on fork-only resources (the Vercel provider, ACM CertificateValidation) before they land upstream, without waiting for an npm release.

Why it is not a plain publish

packages/alchemy is a monorepo member: its name is unscoped (GitHub Packages requires the repository owner's scope) and its dependencies are workspace:*/catalog: references a consumer's package manager cannot resolve — 53 of them across dependencies and peerDependencies. Publishing as-is yields an uninstallable package.

What this adds

  • .github/workflows/publish-alchemy-package.yml — manual dispatch or push to main touching packages/alchemy/**; builds, prepares, publishes to npm.pkg.github.com with packages: write.
  • packages/alchemy/scripts/rewrite-workspace-deps.mjs — rewrites the name to @flatfilers/alchemy, stamps a version (<base>-fork.<short-sha> by default), and resolves every internal reference to its published npm version. It fails loudly if any internal dependency is not on the public registry rather than publishing something broken.

Verified locally: 53 references rewritten, zero left unresolved (@alchemy.run/* → ^2.0.0-beta.83, @distilled.cloud/* → ^1.0.0-rc.15, @alchemy.run/sigil → ^0.1.0-alpha.1). The checked-in manifest is untouched, so upstream merges stay clean.

Consumer side (Obvious)

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@flatfilers:registry=https://npm.pkg.github.com

then depend on @flatfilers/alchemy — subpath exports (/Vercel, /AWS) are unchanged by the scope. Needs a token with read:packages in the consuming repo's secrets.

Waits for a certificate to reach ISSUED, so a cert created without a
Route53 hostedZoneId (external DNS: Vercel, Cloudflare, …) can be
validated by the caller writing the domain validation records first and
then blocking on this resource — the aws_acm_certificate_validation
pattern. Exports regionOfCertificateArn/withCertRegion from Certificate.ts
for reuse, and registers the provider alongside ACM.Certificate.
Internal consumers need fork-only resources before they land upstream. The
package is a monorepo member (unscoped name, workspace:/catalog: deps), so the
publish step rewrites the scope to @flatfilers/alchemy and resolves every
internal dependency to its published npm version — failing loudly if any is
not on the public registry rather than publishing something uninstallable.
The checked-in manifest stays upstream-compatible.
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