Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Determine latest release asset download URL from site.github in GitHub user pages
@dleidert

This comment has been minimized.

Copy link
Owner Author

dleidert commented Feb 24, 2019

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

This comment has been minimized.

Copy link
Owner Author

dleidert commented Feb 24, 2019

{% 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
You can’t perform that action at this time.