feat: allow subsetting to latest package tag

This commit is contained in:
Patrick Schratz 2024-11-03 23:03:05 +01:00
commit 8b96211df0
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -72,7 +72,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
gert::git_config_global_set("advice.detachedHead", "false")
if (is.null(tag)) {
if (tag == "latest" || is.null(tag)) {
gert::git_clone(sprintf("https://github.com/cran/%s", package_name),
path = sprintf("%s/%s", tempdir(), "tmp1"),
verbose = FALSE
@ -84,6 +84,10 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
unlink(sprintf("%s/%s", tempdir(), "tmp1"), force = TRUE, recursive = TRUE)
tag <- all_tags$name
# gert cannot sort by date (which is a problem for properly sorting tags like 1.0-10 and others)
if (tag == "latest") {
system("git tag --sort=-creatordate | head -1")
}
package_name <- rep(package_name, length(tag))
}