Run something like this from the command line before each build:
mkdir -p data
git fetch origin --tags
git tag -l --sort=version:refname --format=$'- name: %(refname:short)\n object: %(objectname)\n type: %(objecttype)' > data/tags.yaml
In the above, replace origin
with the name of the remote (e.g., upstream
) if applicable.
Then access the data from your templates using {{ site.Data.tags }}
.
The data file will look something like this:
- name: v0.136.0
object: 1ad28e1e0e1aa06725265bf3f117300d5116143c
type: commit
- name: v0.141.0
object: 8fa19b50fa4c6e99d77ca84f795540d6b75e8cc8
type: commit