-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rprofile
44 lines (43 loc) · 1.16 KB
/
.Rprofile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
if (Sys.getenv("RENV_DIR") == "") {
# do use renv during GRAN builds, due to a conflict
source("renv/activate.R")
}
.CIaddGranPkg <- function() {
pkg_name <- Sys.getenv("CI_PROJECT_NAME")
env <- Sys.getenv("GRAN_ENV")
if (Sys.getenv("GRAN_REBUILD") == "TRUE") {
rebuild <- TRUE
} else {
rebuild <- FALSE
}
username <- Sys.getenv("GRAN_ID")
api_token <- Sys.getenv("GRAN_TOKEN")
package_url <- paste0(
"https://token:",
Sys.getenv("GITLAB_PROJECT_TOKEN"),
"@",
Sys.getenv("CI_SERVER_HOST"), ":", Sys.getenv("CI_SERVER_PORT"), "/",
Sys.getenv("CI_PROJECT_PATH")
)
branch <- Sys.getenv("GRAN_BRANCH")
if (rebuild && pkg_name %in% granny::availPkgs(env)[, "Package"]) {
# if package is already in GRAN, but needs rebuilding
cat("rebuilding", pkg_name, "\n")
granny::rebuildPkg(
pkg_name = pkg_name,
username = username,
api_token = api_token,
env = env
)
} else {
cat("adding", package_url, branch, "\n")
granny::addPkg(
package_url = package_url,
username = username,
api_token = api_token,
branch = branch,
replace = TRUE,
env = env
)
}
}