Skip to content

Publish a preview of the package on every push - #4

Merged
stefanoverna merged 1 commit into
mainfrom
feat/continuous-releases
Aug 31, 2026
Merged

Publish a preview of the package on every push#4
stefanoverna merged 1 commit into
mainfrom
feat/continuous-releases

Conversation

@stefanoverna

Copy link
Copy Markdown
Member

Every commit pushed to a branch here now produces an installable tarball,
without publishing anything to npm:

npm i https://pkg.pr.new/datocms/astro-datocms/@datocms/astro@<commit-sha>

Why

Every consumer of this package lives in another repository — the Astro starter
kit, the demos, customer sites. Judging a component change means running it in
one of them, which today costs a release or npm link. Now it's a URL that
expires on its own, and a fix can be handed to whoever reported it before we
release.

This is the eleventh repo getting the same workflow; the four monorepos are in
datocms/js-rest-api-clients#58 and its siblings, the other SDKs in
datocms/react-datocms#121, datocms/vue-datocms#111 and datocms/datocms-svelte#20.

Verified on this branch

The run on 4900e3b published the package, and the exact URL documented in the
README installs into a throwaway project with the components present:

node_modules/@datocms/astro
  src/  README.md  package.json
  src/: ContentLink Image QueryListener Seo StructuredText index.ts

Note the URL keeps the repo segment: the package is @datocms/astro but the
repo is astro-datocms, so the two cannot be collapsed the way they are for
react-datocms.

Also in this PR: git://git+https://

repository.url still used git://, which GitHub stopped serving in 2022, so
the field was stale regardless. It also happens to be what pkg.pr.new reads to
decide whether it can mint the short URL form — but it reads the npm
registry
, not this repo, so the short form only starts working one release
from now. Until then the long URL above is the one to use, and it keeps working
afterwards either way.

Choices worth reviewing

Pushes only, no fork pull requests. The workflow runs on pushes to branches
of this repo, which only people with write access can make. This is deliberate:
pkg.pr.new URLs carry our namespace and the tarballs are served
unauthenticated, so an unreviewed fork should not be able to mint one.
pkg.pr.new documents an "approved pull requests only" recipe if we want fork
previews later.

npm run build is kept even though nothing is built. This package ships
src/ uncompiled, so packing works without it — the script is astro check. I
left it in because it is the only type checking that runs anywhere in this repo.
Drop the step if you'd rather previews never be blocked by a type error.

This is the repo's first workflow. There is no CI here at all — no lint,
type check or test on a PR. Adding real CI is a separate PR and worth doing.

One thing to know

Previews are throwaway and the URLs stop resolving after a while. They must
never end up in a package.json that ships.

Every commit pushed to a branch now produces an installable tarball, so a
component change can be tried in a real Astro site without a release:

    npm i https://pkg.pr.new/datocms/astro-datocms/@datocms/astro@<commit-sha>

Nothing reaches npm, no version is spent, and there is nothing to clean
up afterwards. This replaces `npm link` and pinning a git branch by hand,
and it means a fix can be handed to whoever reported it before we cut a
release.

Runs only on pushes to branches of this repo, so a fork cannot mint a URL
under our namespace without a maintainer pushing the code first.

Also replaces the `git://` in `repository.url` with `git+https://`. GitHub
stopped serving `git://` in 2022, so the field was stale either way; it is
also what pkg.pr.new reads — from the npm registry, not from here — to
decide whether it can mint the shorter URL form. So the short form starts
working one release from now, and until then the URL above is the one to
use.

Claude-Session: https://claude.ai/code/session_01TbxhxyU1XBsSKtoCJXwAoD
@stefanoverna
stefanoverna merged commit 626d6c9 into main Aug 31, 2026
2 checks passed
@stefanoverna
stefanoverna deleted the feat/continuous-releases branch August 31, 2026 09:06
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.

1 participant