Skip to content
PolyPack
Docs: Files

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

Every Version · its channels, and each Version's Files with their sizes and SHA-256
curl -fsS -H "Authorization: Bearer <your Token>" https://hopper.pkg.polypack.io/files/hopper-cli/index.json
Download the latest · latest is the newest stable Version; a channel such as beta works the same way
curl -fL -H "Authorization: Bearer <your Token>" -o <file> https://hopper.pkg.polypack.io/files/hopper-cli/latest/<file>
Check it · in the directory you downloaded to; SHA256SUMS.sig is PolyPack's signature of it
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.
  • latest is the highest Version that is not a pre-release, so a 1.4.1 hotfix released after 2.0.0 never becomes everyone's latest.
  • Any other channel is named by a pre-release: beta is the highest Version that is either stable or a -beta one, so it gives 2.1.0-beta.3 until 2.1.0 is out, and then 2.1.0. rc, nightly and others work the same way.
  • Channels are worked out for each Token: a Client sees only the Versions its Grant covers, so latest for a Client whose updates ended in June is its last Version from before then.
  • index.json lists 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:

With the polypack CLI · signed in with polypack login, or with a Token that can publish in POLYPACK_TOKEN; each File is checked, and the Version appears only once all are in
polypack files upload hopper-cli@1.0.0 dist/* --team hopper --publish
With curl · each File goes straight to storage, up to 5 GiB; nothing appears until publish, and then it never changes. Needs jq
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
  1. 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.
  2. Upload the bytes to that URL. They go straight to storage, not through PolyPack, so a File can be up to 5 GiB.
  3. Complete the upload: PolyPack checks the size and SHA-256 it was told.
  4. 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

GitHub Actions · a workflow job's step; store a Team Token as the secret POLYPACK_TOKEN (Settings → Secrets → Actions)
- 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 }}