fix: fix tag parsing for 'latest'
This commit is contained in:
parent
93f872a8eb
commit
7797efc8c5
1 changed files with 134 additions and 133 deletions
|
|
@ -72,22 +72,23 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
|||
|
||||
gert::git_config_global_set("advice.detachedHead", "false")
|
||||
|
||||
if (tag == "latest" || is.null(tag)) {
|
||||
if (is.null(tag) || tag == "latest") {
|
||||
gert::git_clone(sprintf("https://github.com/cran/%s", package_name),
|
||||
path = sprintf("%s/%s", tempdir(), "tmp1"),
|
||||
verbose = FALSE
|
||||
)
|
||||
# Retrieve all tags
|
||||
all_tags <- gert::git_tag_list(repo = sprintf("%s/%s", tempdir(), "tmp1"))
|
||||
# filter out tags that start with R- (= non-valid ones)
|
||||
all_tags <- all_tags[!grepl("R-", all_tags$name), ]
|
||||
|
||||
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")
|
||||
}
|
||||
if (!is.null(tag) && tag == "latest") {
|
||||
tag = system("git tag --sort=-creatordate | head -1", intern = TRUE)
|
||||
} else {
|
||||
# Retrieve all tags
|
||||
all_tags <- gert::git_tag_list(repo = sprintf("%s/%s", tempdir(), "tmp1"))
|
||||
# filter out tags that start with R- (= non-valid ones)
|
||||
all_tags <- all_tags[!grepl("R-", all_tags$name), ]
|
||||
|
||||
unlink(sprintf("%s/%s", tempdir(), "tmp1"), force = TRUE, recursive = TRUE)
|
||||
tag <- all_tags$name
|
||||
}
|
||||
package_name <- rep(package_name, length(tag))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue