Repository navigation
Mirror 1.0.0 to GitHub Packages without rebuilding it - #33
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Adds a guarded workflow that publishes the existing
disktop@1.0.0to 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 thenameline ofpackage.jsonchanged and nothing else. It is not a rebuild and does not touch npmjs.org.scripts/mirror-github-package.mjsrequires 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 withnpm pack, and refuses the result unless every other entry has identical bytes and mode..github/workflows/mirror-github-packages.ymlprepareruns read-only on PRs and on dispatch. It downloads and verifies the npm artifact with the existingverify-registry-release.mjs download, derives and compares the mirror, installs it into a clean prefix, and runs--version,--helpand a real scan with the packaged helper.publishruns only when dispatched frommainwithMIRROR 1.0.0, in the protectednpm-publishenvironment. It reads no npm secret. It checks the digest, creates a GitHub artifact attestation (npm provenance does not exist on GitHub Packages), and runsnpm publish <tarball> --ignore-scriptswithGITHUB_TOKEN. It then re-downloads the package and requires the same SHA-256, and requires the clean install's lockfile integrity to match.scripts/tarball.mjs) andworkflowBlock(tests/support/workflows.mjs) are now shared instead of copied.Plan traceability
scripts/,.github/workflows/, release documentation.1.0.0npm release and its record stay as they are.1.0.0artifact is not modified.Safety and public behavior
There are no cleanup, scanner, CLI, JSON, TUI or report changes. Publication safety:
mainwith confirmation text and reviewer approval.Verification
npm packin a temp dir, plus the realdisktop-1.0.0.tgzin a scratch directory.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 vianpm pack, lockfile checks, and workflow contracts.npm run typecheckandnpm run lintpass.npm test: 1,106 passed, 0 failed.DISKTOP_PACKAGE_REQUIRE_ALL_TARGETS=1): 10/10.preparejob's run blocks, executed locally: npm artifact verified, mirror entries identical apart from the name line, clean install--version=1.0.0, scancomplete/exit 0.preparerun passed on GitHub: npm artifacta2deddd7…verified, mirror derived and compared, installed, scanned.86910f5e…locally (Node 26, both npm 11 and 12) and1b23622b…on the runner, with identical entries both times. The workflow therefore compares entries rather than pinning a compressed digest, andpublishtakes its digest from the same run'spreparejob.preparerun checks the workflow on GitHub.docs/release-readiness.md, plus a README install note once the package is public.