• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Contextualist/glare: gracefully download (latest) releases from GitHub

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Contextualist/glare

开源软件地址:

https://github.com/Contextualist/glare

开源编程语言:

Python 100.0%

开源软件介绍:

Glare

Deploy with Vercel

A little service for you to download releases from GitHub gracefully. Simply make a get request to Glare with the repo name (with an optional version) and release file name regex, and she will lead you to the way.

NOTE: You might want to use GitHub's direct link to the latest release asset (e.g. github.com/{owner}/{repo}/releases/latest/download/asset-name.zip) if the asset name is a constant string. Otherwise Glare is still helpful for matching the asset with regex.

Demo

The following will redirect you to https://github.com/xtaci/kcptun/releases/download/{latest_version_tag}/kcptun-linux-amd64-{latest_version_number}.tar.gz, and download the latest release of kcptun for linux-amd64.

curl -fLO https://glare.now.sh/xtaci/kcptun/linux-amd64

Or you might want to have a version constraint:

curl -fLO https://glare.now.sh/v2fly/[email protected]/linux-64

Motivation

Sometimes when I'm writing a Dockerfile, I need to install packages from their GitHub latest releases. A neat way is to parse JSON responses from GitHub API with jq and get the desire link. Such way requires downlaoding jq from GitHub (The binary from Alpine apk is lack of regex feature). Still, the expression with jq is not clear enough, and parsing JSON with sed is way dirtier. So I spend a little time to write Glare. I hope she will save you a few minutes or from a frustring moment.

Usage

# To get the latest release...
/{owner}/{repo}/{file_name_regex}

# To get a specific version or pick within a version range...
/{owner}/{repo}@{tag|semver}/{file_name_regex}

{file_name_regex} is a regular expression to match the file (or specially, it can be tar or zip standing for the source code download in the respective format). It should match at least one file among the latest release files, otherwise Glare will throw an error. If multiple files are matched, Glare returns the one with shortest length.

If {tag} is given, Glare looks for a release with exact matching tag. For {semver} provided, Glare treats it as a npm-flavor semver and matches all release tag names against it. The highest of all satisfied versions is chosen.

Tip: to check if a request leads to the desired redirection, curl it without any option.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap