Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dleidert/99a8e6ee3a879a7ed1f160c5dd07c13d to your computer and use it in GitHub Desktop.

Select an option

Save dleidert/99a8e6ee3a879a7ed1f160c5dd07c13d to your computer and use it in GitHub Desktop.
Determine latest release asset download URL from site.github in GitHub user pages
@dleidert
Copy link
Copy Markdown
Author

Considering there are several assets and the asset file name is created the same way for every release but includes the version number (e.g. foo-X.Y.Z-setup.exe or foo-X.Y.Z-src.tar.gz), there is also another approach, that might be to used. One can process

{{ site.github.latest_release.tag_name }}

and create the download URL like this

{{ site.github.releases_url }}/download/latest/foo-{{ site.github.latest_release.tag_name | strip | remove 'v' }}-setup.exe
{{ site.github.releases_url }}/download/latest/foo-{{ site.github.latest_release.tag_name | strip | remove 'v' }}-src.tar.gz

(because it is common to tag the version as vX.Y.Z the leading v is removed from the version tag in the above examples)

@dleidert
Copy link
Copy Markdown
Author

{% assign msi = site.github.latest_release.assets | where: "content_type", "application/x-msdownload" %}

then iterate over it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment