Skip to content

A generic front-end to the GitHub releases system, akin to the Pachwork one

License

MIT and 3 other licenses found

Licenses found

MIT
LICENSE
OFL-1.1
LICENSE-Merriweather
Apache-2.0
LICENSE-Roboto
Unknown
LICENSE-short
Notifications You must be signed in to change notification settings

nabijaczleweli/release-front

A generic front-end to the GitHub releases system, akin to the Patchwork one.

Usage

Quickstart

If you just want to check it out, see this live version, always up-to-date with master. Alternatively, use GitHack to see any older version under https://rawcdn.githack.com/nabijaczleweli/release-front/<COMMIT HASH>/index.html.

To display a release for a specific repo query the repo slug in the form of ?owner/repo or put the slug/GitHub URL to somewhere within the repo in the input box.

Overview

The contents of the project release page itself depend on the contents of the repo and the latest tag.

If the repo contains no tags, an error is presented.

If the repo at the latest tag contains a logo image in a Findable Spot™, it's displayed at the top-center, otherwise, a heading with just the repo name is used.

The local system is guessed from the browser's user agent and divided into three categories: Windows, Mac, and Linux, where Linux is equivalent to "not Windows and not Mac".

The release's assets are ranked according to their names, the most significant is the extension – "exe" for Windows, "dmg" for Mac, and "out"/none for Linux. For ranking details, see the documentation of assets::rank_assets().

Configuration

If you distribute your assets with a non-obvious naming scheme, your logo is in a non-"standard" place, or you distribute universal/non-platform-dependent assets, you may wish to use an explicit configuration file to specify them for use with release-front.

To do so, create a file named "release-front.json" on the branch with content in the following format:

Property name Property type Required? Description
logo/logo_url string No Either custom subpath to the logo (e.g. "images/logo.jpeg2000"), or a URL to one (e.g. "//dinosaur.is/patchwork-downloader/images/invite-letterhead.jpg"). Defaults to the normal search.
assets/asset_spec object No If present, overrides default asset ranking. The object keys are, case-insensitive, all optional, any of "Windows", "Mac", "Linux" – values are templated strings resolving to the names of the assets (e.g. "cargo-install-update-${TAG_NAME}.exe"). If a key for a platform is missing, or the value null, it is treated as if there were no assets for that platform.
universal boolean/object No If present, overrides assets. If true, equivalent to {platform: "universal"}. For more details, see table below.

Configuration of universal/platform-independent releases (after normalisation, e.g. from true):

Property name Property type Required? Description
name/platform/pseudo_platform string No If present, platform name to use instead of "for [Windows/Mac/Linux]". Used in form "Download <name>".
asset/asset_spec string No If present, the name of the single asset to use, regardless of platform, templated as usual.

For example, config for an app with a repository-local logo and releases for Windows and Linux:

{
	// This will use the specified path within the repo at the tag.
	"logo": "theobromines/images/big/1241.JPG",

	"asset_spec": {
		"Windows": "chemlab-3k-${TAG_NAME}.exe",  // e.g. for the tag "v0.3.1", this'd yield "chemlab-3k-v0.3.1.exe"
		"mac": null,                              // Might as well've been omitted.
		"LINUX": "chemlab3k_${TAG_NAME_REDUCED}"  // e.g. for the tag "v0.3.1", this'd yield "chemlab3k_0.3.1"
	}
}

Otherwise, an example for a universal app with a remote logo:

{
	"logo": "//dinosaur.is/patchwork-downloader/images/invite-letterhead.jpg",

	"universal": {
		"platform": "",                                   // => the button will just say "Download"
		"asset": "patchwork-invite-${TAG_NAME}.min.html"
	}
}

Details

Logo search paths

First found file named any of: "logo", "icon" under: the repository root, "assets" folder extended with any of: "png", "jpg".
Or, if you want to be very pedantic: first hit in ["", "assets/"]×["logo", "icon"]×[".png", ".jpg"].

Configuration asset names' templates

All templates take the form of "${TEMPNAME}", where TEMPNAME is one of the following:

Name Description
"TAG_NAME" Raw name of the release's tag (e.g. "v0.3.1").
"TAG_NAME_REDUCED" Name of the release's tag stripped mostly to just the numbers (IOW the front 'v' is removed, if any; PRs/issues welcome) (e.g. "0.3.1" if the tag is "v0.3.1").

Self-hosting

Just copy the contents of the gh-pages branch or build the page yourself and slam it (the branch, or the contents of the out folder) in any static server under any access path and it should Just Work™.