mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Use GitHub API to get latest release #116

Closed eine closed 5 years ago

eine commented 5 years ago

In https://github.com/mviereck/x11docker/blob/master/x11docker#L1092-L1093 a file is downloaded from master (CHANGELOG.md) and it is parsed in order to find the tag of the latest release, which is the one downloaded in zip format as commented in #115.

This is the current parsing procedure:

curl -fsSL "https://raw.githubusercontent.com/mviereck/x11docker/master/CHANGELOG.md" | grep "## \[" | grep -v 'Unreleased' | head -n1 | cut -d[ -f2 | cut -d] -f1

I might be improved by using the GitHub API directly. A JSON file is returned, which can be parsed more easily because it contains a field with the expected data:

curl -s https://api.github.com/repos/mviereck/x11docker/releases/latest | grep "\"name" | sed 's/.* "\(.*\)",/\1/g'

The benefits of this approach are:

I think that the rate limit applies to both of them, so there is no improvement in this sense.

mviereck commented 5 years ago

I'll keep parsing CHANGELOG.md. It follows Keep a changelog and is intended to be parseable. The Github API is specific to Github and I don't want to depend on it.

In fact, I consider to move x11docker to Gitlab due to Microsofts's takeover of Github.