feat(resourcepack): publish SHA-1 and a JSON manifest alongside SHA256 - #27
Merged
Conversation
SHA-1 is the hash Minecraft actually uses - `resource-pack-sha1` in server.properties and the second argument of `setResourcePack(url, hash)` are both SHA-1. The workflow only ever published SHA256, and its header comment claimed that was the value handed to the client, so a caller had no way to get the hash it needs. Every archive now ships a checksum file per algorithm plus a JSON manifest carrying version, URL, size, commit and all hashes at once. The `latest` manifest also resolves which version the alias currently points at, which no checksum file can express. Which algorithms get published is the `HASH_ALGOS` list at the top of the job - the only place in the file that names one. Checksum files, manifest entries, the Discord message and the job summary all derive from it, and the validate step rejects a typo there before anything is built. Adding sha512 is one list entry plus the matching `outputs:` declaration, which GitHub requires to be static. To support that, URL construction moved into the meta step (endpoint, bucket and prefix are plain inputs and never needed the upload to have happened), which lets the build step write a finished manifest instead of the upload step stitching metadata together afterwards. The build step also emits the upload plan - which local file goes to which key, with which content type and cache policy - leaving the upload step purely mechanical and free of any knowledge of algorithms or file names. Existing outputs are untouched; sha1, manifest-url and latest-manifest-url are additions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XjNkUEGG5ASJLryBY2wQST
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.
Why
SHA-1 is the hash Minecraft actually uses:
resource-pack-sha1inserver.propertiesand the second argument ofsetResourcePack(url, hash)are both SHA-1. This workflow only ever published SHA256 — and its header comment claimed that was the value handed to the client. A consumer had no way to obtain the hash it actually needs.What changes
SHA-1 is added, SHA256 stays. Every archive now ships a checksum file per algorithm plus a JSON manifest:
The manifest carries version, URL, size, commit and every hash in one request. The
latestmanifest additionally resolves which version the alias currently points at — something no checksum file can express.hashesis an object rather than flat fields, so another algorithm is one more key and not a schema break;schemaVersionmarks a real break if one ever happens.Maintainability — exactly one place names an algorithm.
HASH_ALGOS: "sha1 sha256"at the top of the job. Checksum files, manifest entries, the Discord message and the job summary all derive from it; Discord and the summary read their values out of the manifest withjqrather than naming hashes themselves. Addingsha512means one list entry plus the matchingoutputs:declaration, which GitHub requires to be static. The validate step rejects a typo in that list before anything is built.Two refactors carry that:
metastep. Endpoint, bucket and prefix are plain inputs and never needed the upload to have happened. That lets the build step write a finished manifest instead of the upload step stitching metadata together afterwards.src⇥key⇥content-type⇥cache-control). The upload step just iterates over it and knows nothing about algorithms or file names — "what gets published" and "how it gets uploaded" are now separate.Discord and the job summary lead with SHA-1, noting
resource-pack-sha1, because that is the value someone copies into a server config.Compatibility
Not a breaking change.
version,file-name,sha256,urlandlatest-urlare untouched;sha1,manifest-urlandlatest-manifest-urlare additions. Existing consumers keep working unchanged and get the new files for free.Verification
The
runblocks were extracted from the YAML and executed against a test pack with${{ }}expressions resolved (awsandcurlstubbed):latest-aliastrueandfalse— every run clean, with the upload plan carrying the correct keys and cache policies (versioned keysimmutable, alllatestkeysmust-revalidate).sha1sum -candsha256sum -cpass against both copies — the alias checksum files record the alias' own file name.HASH_ALGOSguard: an empty list and a typo (shaXYZ) fail with an explicit message;sha1 sha256 sha512passes.bash -nclean across all eightrunblocks; markdownlint reports only the four table issues on line 203 that already exist onmain.🤖 Generated with Claude Code
https://claude.ai/code/session_01XjNkUEGG5ASJLryBY2wQST