Skip to content

Mirror 1.0.0 to GitHub Packages without rebuilding it - #33

Merged
Dijo-404 merged 2 commits into
mainfrom
feat/github-packages-mirror
Nov 8, 2026
Merged

Dijo-404 merged 2 commits into
mainfrom
feat/github-packages-mirror

Conversation

@Dijo-404

@Dijo-404 Dijo-404 commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Change

Adds a guarded workflow that publishes the existing disktop@1.0.0 to GitHub Packages as @dijo-404/disktop@1.0.0, linked to this repository. GitHub's npm registry accepts only owner-scoped names, so the mirror is the published npm tarball with the name line of package.json changed and nothing else. It is not a rebuild and does not touch npmjs.org.

  • scripts/mirror-github-package.mjs requires the audited npm tarball (a2deddd7…) and stages its entries without letting an entry name choose a path. It rewrites only the top-level name line, repacks with npm pack, and refuses the result unless every other entry has identical bytes and mode.
  • .github/workflows/mirror-github-packages.yml
    • prepare runs read-only on PRs and on dispatch. It downloads and verifies the npm artifact with the existing verify-registry-release.mjs download, derives and compares the mirror, installs it into a clean prefix, and runs --version, --help and a real scan with the packaged helper.
    • publish runs only when dispatched from main with MIRROR 1.0.0, in the protected npm-publish environment. It reads no npm secret. It checks the digest, creates a GitHub artifact attestation (npm provenance does not exist on GitHub Packages), and runs npm publish <tarball> --ignore-scripts with GITHUB_TOKEN. It then re-downloads the package and requires the same SHA-256, and requires the clean install's lockfile integrity to match.
  • The tarball reader (scripts/tarball.mjs) and workflowBlock (tests/support/workflows.mjs) are now shared instead of copied.
  • Docs: maintainer steps in CONTRIBUTING, a pending mirror section in the release record, a note in AGENTS.md that the mirror is not a rebuild, and the tester issue template names both packages.

Plan traceability

  • Owning folder or module: scripts/, .github/workflows/, release documentation.
  • PLAN.md phase and feature acceptance row: Phase 8 distribution. No acceptance row changes; the 1.0.0 npm release and its record stay as they are.
  • Port, schema, provider ID, or persisted format changed: none. No runtime code changes. The shipped 1.0.0 artifact is not modified.

Safety and public behavior

There are no cleanup, scanner, CLI, JSON, TUI or report changes. Publication safety:

  • The source must match the audited SHA-256.
  • The output must match the source in every entry except one line.
  • Publishing needs a dispatch from main with confirmation text and reviewer approval.
  • GitHub Packages refuses an existing version, so a rerun cannot replace it.

Verification

  • Fixture or sandbox used: a synthetic package packed with npm pack in a temp dir, plus the real disktop-1.0.0.tgz in a scratch directory.
  • Acceptance test added or updated: tests/unit/github-packages-mirror.test.mjs (7 tests). It covers manifest rewriting and its refusals, entry comparison refusals (bytes, mode, extra, missing, type, duplicate, manifest drift), unsafe entry paths, end-to-end derivation via npm pack, lockfile checks, and workflow contracts.
  • Commands run and results:
    • npm run typecheck and npm run lint pass. npm test: 1,106 passed, 0 failed.
    • Package test against the exact published tarball (DISKTOP_PACKAGE_REQUIRE_ALL_TARGETS=1): 10/10.
    • The prepare job's run blocks, executed locally: npm artifact verified, mirror entries identical apart from the name line, clean install --version = 1.0.0, scan complete/exit 0.
    • This PR's prepare run passed on GitHub: npm artifact a2deddd7… verified, mirror derived and compared, installed, scanned.
    • The mirror's gzip digest depends on the runner's Node/zlib build. It was 86910f5e… locally (Node 26, both npm 11 and 12) and 1b23622b… on the runner, with identical entries both times. The workflow therefore compares entries rather than pinning a compressed digest, and publish takes its digest from the same run's prepare job.
    • shellcheck on the extracted run blocks: clean.
  • Remaining limits or follow-up work:
    • actionlint was not run locally. This PR's prepare run checks the workflow on GitHub.
    • After merge, dispatch and approve the workflow. GitHub creates the package as private; making it public is a manual, irreversible package-settings change.
    • The run, digest, attestation and visibility then get recorded in docs/release-readiness.md, plus a README install note once the package is public.

GitHub's npm registry accepts only owner-scoped names, so disktop@1.0.0
is mirrored as @dijo-404/disktop@1.0.0. The mirror is the published npm
tarball, checked against its audited SHA-256 and the registry's SHA-512,
with only the name line of package.json changed; every other entry is
proven byte- and mode-identical before anything is published.

mirror-github-packages.yml runs a read-only prepare job on pull requests
and on dispatch: download, derive, compare, install into a clean prefix
and scan with the packaged helper. The publish job runs only when
dispatched from main with the confirmation text, behind the protected
npm-publish environment. It attests the file, publishes it with
GITHUB_TOKEN, and verifies a clean install from GitHub Packages against
the same digest. The manifest's repository field links the package.

The tarball reader and workflow-block helper move to shared modules so
the package test, release contract and mirror use one implementation.
Copilot AI balanced review requested due to automatic review settings November 8, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Dijo-404
Dijo-404 merged commit e67dc90 into main Nov 8, 2026
5 of 11 checks passed
@Dijo-404
Dijo-404 deleted the feat/github-packages-mirror branch November 8, 2026 17:28
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