{
"path": "/3mjdsuh3nqs2y",
"site": "at://did:plc:nuc33thnsiqzhytkleyr5jek/site.standard.publication/3mjdo3xyaoc2l",
"tags": [
"github",
"sed",
"shell",
"curl",
"nushell"
],
"$type": "site.standard.document",
"title": "Get the latest release from a GitHub repo",
"content": {
"$type": "pub.leaflet.content",
"pages": [
{
"id": "019d84a5-9e9a-722e-813c-c857b052ef91",
"$type": "pub.leaflet.pages.linearDocument",
"blocks": [
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"plaintext": "The following is a collection of ways to get the latest release of a program from its GitHub repository, using the command line. The example repositories used below can be replaced with any repository hosted on GitHub."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "sed"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 49,
"byteStart": 46
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
}
],
"plaintext": "This gets the URL of the latest release using sed. It then filters out files that contain \".rpm\" and \".deb\"."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "curl -s https://api.github.com/repos/matheus-git/systemd-manager-tui/releases/latest \\\n | sed -n 's/.*\"browser_download_url\": //p' \\\n | grep -v -E \".rpm|.deb\" \\\n | tr -d '\"'\n\nOutput:\nhttps://github.com/matheus-git/systemd-manager-tui/releases/download/v1.2.4/systemd-manager-tui",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 58,
"byteStart": 56
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
},
{
"index": {
"byteEnd": 82,
"byteStart": 79
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
}
],
"plaintext": "To get the SHA256 digest corresponding to the file, use jq in combination with awk."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "curl -s https://api.github.com/repos/matheus-git/systemd-manager-tui/releases/latest \\\n | jq -c '.assets.[] | select(.browser_download_url | contains(\".deb\") or contains(\".rpm\") | not) | .digest' \\\n | tr -d '\"' \\\n | awk -F: '{print $2}'\n\nOutput:\n63a977112f97462d55a4e41fc0280d32b3f801c3b9f0fad329cd79843c7ae1ec",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "jq"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 48,
"byteStart": 46
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
},
{
"index": {
"byteEnd": 142,
"byteStart": 140
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
}
],
"plaintext": "This gets the URL of the latest release using jq. If you know that the file you want contains \"bw-linux-arm64\" in the filename, you can use jq to select it."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "curl -s https://api.github.com/repos/bitwarden/clients/releases/latest \\\n | jq -r '.assets[] | select(.name | contains(\"bw-linux-arm64\")) | .browser_download_url'\n\nOutput:\nhttps://github.com/bitwarden/clients/releases/download/cli-v2026.3.0/bw-linux-arm64-2026.3.0.zip",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 30,
"byteStart": 26
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
},
{
"index": {
"byteEnd": 44,
"byteStart": 39
},
"features": [
{
"$type": "pub.leaflet.richtext.facet#code"
}
]
}
],
"plaintext": "You can then pipe this to curl via the xargs command to download the file to the current working directory."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "shellscript",
"plaintext": "curl -s https://api.github.com/repos/bitwarden/clients/releases/latest \\\n | jq -r '.assets[] | select(.name | contains(\"bw-linux-arm64\")) | .browser_download_url' \\\n | xargs -I {} curl -SL -O {}",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "Nushell"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.text",
"plaintext": "This gets the URL of the latest release of Bitwarden using Nushell."
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.code",
"language": "nushell",
"plaintext": "http get https://api.github.com/repos/bitwarden/clients/releases/latest\n| get assets.browser_download_url\n| find \"bw-linux-arm64\"\n| get 0\n\nOutput:\nhttps://github.com/bitwarden/clients/releases/download/cli-v2026.3.0/bw-linux-arm64-2026.3.0.zip",
"syntaxHighlightingTheme": "catppuccin-mocha"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.header",
"level": 2,
"plaintext": "More examples"
}
},
{
"$type": "pub.leaflet.pages.linearDocument#block",
"block": {
"$type": "pub.leaflet.blocks.unorderedList",
"children": [
{
"$type": "pub.leaflet.blocks.unorderedList#listItem",
"content": {
"$type": "pub.leaflet.blocks.text",
"facets": [
{
"index": {
"byteEnd": 68,
"byteStart": 0
},
"features": [
{
"uri": "https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8",
"$type": "pub.leaflet.richtext.facet#link"
}
]
}
],
"plaintext": "https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8"
}
}
]
}
}
]
}
]
},
"description": "",
"publishedAt": "2026-04-11T02:26:00.000Z"
}