Files
Publish binaries, plugins and builds as versioned Files, downloaded with a Token and kept up to date by your own updater.
A Files Pack holds anything that is not an npm or Composer package or an image: command-line tools, desktop apps, WordPress plugins and themes, firmware, build outputs. Each Version holds one or more Files, such as a binary per platform. Files are served from your Team's host under https://hopper.pkg.polypack.io/files/, with the same Tokens, Clients, Grants and download statistics as any Pack, and they count toward your Plan's storage. Files are part of Plans that include them.
Download
curl -fsS -H "Authorization: Bearer <your Token>" https://hopper.pkg.polypack.io/files/hopper-cli/index.json
curl -fL -H "Authorization: Bearer <your Token>" -o <file> https://hopper.pkg.polypack.io/files/hopper-cli/latest/<file>
curl -fsS -H "Authorization: Bearer <your Token>" https://hopper.pkg.polypack.io/files/hopper-cli/<version>/SHA256SUMS | sha256sum --check --ignore-missing
Send a Token as Authorization: Bearer; a public Pack downloads without one. Downloads redirect to storage for a few minutes, so keep -L (or -fL) on curl. Every download of a File counts as a download of its Version, by the Token that asked.
Versions and channels
- Versions are SemVer:
1.4.0,2.0.0-beta.1. latestis the highest Version that is not a pre-release, so a1.4.1hotfix released after2.0.0never becomes everyone's latest.- Any other channel is named by a pre-release:
betais the highest Version that is either stable or a-betaone, so it gives2.1.0-beta.3until2.1.0is out, and then2.1.0.rc,nightlyand others work the same way. - Channels are worked out for each Token: a Client sees only the Versions its Grant covers, so
latestfor a Client whose updates ended in June is its last Version from before then. index.jsonlists every Version the Token may read, newest first, with each File's size and SHA-256, and what each channel resolves to.
Checking a download
Each Version has a SHA256SUMS, generated by PolyPack in the format sha256sum writes, so sha256sum --check checks what you downloaded. When this PolyPack signs, SHA256SUMS.sig is its signature of that file, with PolyPack's key (see Signatures and provenance), and cosign verify-blob --key checks it.
Keeping storage in check
A Pack's Retention action (Admins) keeps the newest few stable Versions and pre-releases, or removes those older than a number of days, every night. It shows what it would remove before you save, and it never removes the latest Version, the newest one a Client's Grant allows, a channel's Version, anything downloaded in the last 30 days, or a Version in a supported line. Docker images, Composer and npm Packs have retention too: untagged images, old pre-releases and stale branches.
Publish
An Admin creates the Files Pack in PolyPack first (Packs, New Pack, Files). Then, with a Token that can publish:
polypack files upload hopper-cli@1.0.0 dist/* --team hopper --publish
TOKEN=<your Token> # a Token with publish
VERSION=1.0.0
for FILE in dist/*; do
UPLOAD=$(curl -fsS -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"name\":\"$(basename "$FILE")\",\"size\":$(wc -c < "$FILE" | tr -d ' '),\"sha256\":\"$(shasum -a 256 "$FILE" | cut -d' ' -f1)\"}" \
https://hopper.pkg.polypack.io/files/hopper-cli/$VERSION/uploads)
curl -fsS -X PUT -T "$FILE" "$(echo "$UPLOAD" | jq -r .url)"
curl -fsS -X POST -H "Authorization: Bearer $TOKEN" "$(echo "$UPLOAD" | jq -r .complete_url)"
done
curl -fsS -X POST -H "Authorization: Bearer $TOKEN" https://hopper.pkg.polypack.io/files/hopper-cli/$VERSION/publish
- Reserve each File: its name, size and SHA-256. PolyPack checks your Plan and storage, and answers with a URL to upload it to, valid for 15 minutes.
- Upload the bytes to that URL. They go straight to storage, not through PolyPack, so a File can be up to 5 GiB.
- Complete the upload: PolyPack checks the size and SHA-256 it was told.
- Publish the Version. Until then it is a draft that nobody sees, so nobody ever gets a Version with only some of its Files. Once published, its Files never change: publish a new Version instead.
An Admin can publish or discard a draft on the Pack's page, and download any File there.
From GitHub Actions
A release workflow can publish Files with no PolyPack Token stored in GitHub: an Admin adds a trusted publisher to the Pack, and PolyPack's GitHub Action uploads the Files and publishes the Version, with files: dist/* and version: ${{ github.ref_name }}. Versions published this way carry signed provenance, a subject per File, which cosign verify-blob-attestation checks (see Signatures and provenance).
With the polypack CLI
polypack files download hopper-cli downloads the latest Version's Files (or hopper-cli@beta, hopper-cli@1.2.0, and --file for one), checks each against SHA256SUMS and PolyPack's signature, and saves nothing that does not check. polypack files upload hopper-cli@1.2.0 dist/* --publish publishes, as above.
In CI
- run: curl -fL -H "Authorization: Bearer $POLYPACK_TOKEN" -o <file> https://hopper.pkg.polypack.io/files/hopper-cli/latest/<file>
env:
POLYPACK_TOKEN: ${{ secrets.POLYPACK_TOKEN }}