-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download latest main #32
Conversation
Add explicit check for the latest `main` version by pulling all package files and then filtering for the `main` label and finding the max `version`.
Explicitly downloads the max `build_number` for available distributions so that we are using the latest build.
devel/download-latest
Outdated
curl -fsSL https://api.anaconda.org/package/nextstrain/nextstrain-base/files | jq -r ' | ||
map(select(.labels|index("main"))) | ||
| map(select(.attrs.subdir == env.CONDA_SUBDIR)) | ||
| .[0].download_url | ||
| (max_by(.version) | .version) as $max_version | ||
| . | ||
| map(select(.version == $max_version)) | ||
| max_by(.attrs.build_number) | ||
| .download_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This a was a fun way to learn more jq
but please let me know if this is too convoluted or if there's better way do this 🙏
curl -fsSL https://api.anaconda.org/release/nextstrain/nextstrain-base/latest | jq -r ' | ||
.distributions | ||
curl -fsSL https://api.anaconda.org/package/nextstrain/nextstrain-base/files | jq -r ' | ||
map(select(.labels|index("main"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking
For boolean containment, jq has a contains()
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided against contains()
because it returns true even for substring containments.
The following returns true:
jq 'contains(["ab"])' <<< '["abcde"]'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! That's a good reason.
Thanks @tsibley for pointing out that `max_by` accepts an array of paths and will sort in order of the provided array. Co-authored-by: Thomas Sibley <[email protected]>
Description of proposed changes
Updates
devel/download-latest
to pull themain
labeled package with the maxversion
andbuild_number
so that our CI diffs of packages only compares against the latestmain
version.Related issue(s)
Similar to changes we made in the Nextstrain CLI (nextstrain/cli#280).
Fixes #26
Testing