Version badges¶
Sleet can write a small JSON file with the latest version of each package. Use these files with shields.io to show the latest stable or prerelease version from a public feed.
Enable badges¶
Badges are off on new feeds. Turn them on with the badgesenabled feed setting:
Sleet updates a badge when a push or delete changes the latest version of a package. To create badges for packages that are already on the feed, run sleet recreate after you turn badges on. For a local feed whose baseURI is different from path, use rebuild a local feed without recreate instead.
To stop updating badges, set the value back to false:
Turning badges off doesn't delete the badge files that already exist.
Badge files¶
Sleet writes these files when badges are enabled:
| Badge | Feed file |
|---|---|
| Stable version | badges/v/{id}.json |
| Prerelease version | badges/vpre/{id}.json |
The package id is lowercased. Sleet no longer writes SVG badge files. When an old SVG file exists for a package id that no longer has a badge version, Sleet deletes the old SVG and JSON badge files.
For the stable badge, Sleet uses the newest stable version. If the package has no stable version, it falls back to the newest prerelease version. For the prerelease badge, Sleet uses the newest version including prerelease versions.
JSON format¶
Sleet writes Shields endpoint JSON like this:
Stable versions use color #007ec6. Prerelease versions use color #dfb317.
Shields endpoint URLs¶
Use the feed root URL, not the index.json URL. The feed root includes the Azure container, S3 bucket, local web root, and any feedSubPath.
Stable badge:
Prerelease badge:
Markdown example:
[](https://myaccount.blob.core.windows.net/feed/index.json)
Shields supports query parameters such as style and label. See the Shields endpoint badge documentation.
Public access requirement¶
shields.io must be able to fetch the JSON file anonymously. Private feeds cannot use shields.io-hosted badges unless the badge JSON endpoint is public.