|
1 | 1 | quiet = "--quiet" %in% commandArgs(FALSE) |
2 | 2 | formats = commandArgs(TRUE) |
3 | | -# travis is still use for github page deployment |
4 | | -# TODO: Remove github page deployment |
5 | | -ghpages = identical(Sys.getenv("DEPLOY_GH_PAGES", NA), "true") |
6 | 3 |
|
7 | 4 |
|
8 | 5 | src = (function() { |
@@ -34,44 +31,11 @@ for (f in list.files('_book', '[.]html$', full.names = TRUE)) { |
34 | 31 | x = readLines(f) |
35 | 32 |
|
36 | 33 | if (length(i <- grep('^\\s*<body>\\s*$', x)) == 0) next |
37 | | - # patch HTML files when published to gh-pages to redirect to bookdown.org |
38 | | - if (ghpages) x[i[1]] = '<body onload="window.location = \'https://bookdown.org/yihui\'+location.pathname">' |
39 | 34 | i = grep('<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">.+</a>', x)[1] |
40 | 35 | # shorter title on the toolbar |
41 | 36 | if (!is.na(i)) x[i] = gsub('bookdown: ', '', x[i], fixed = TRUE) |
42 | | - # Remove some lines when published to gh-pages |
43 | | - if (ghpages) { |
44 | | - i = c( |
45 | | - grep('<bytecode: 0x[0-9a-f]+>$', x), |
46 | | - grep('^\\s*<meta name="generator" content="bookdown [.0-9]+ and GitBook [.0-9]+" />$', x), |
47 | | - grep('^<meta name="date" content="[-0-9]+" />$', x) |
48 | | - ) |
49 | | - if (length(i)) x = x[-i] |
50 | | - } |
51 | 37 |
|
52 | 38 | writeLines(x, f) |
53 | 39 | } |
54 | 40 |
|
55 | | -# When several format are rendered, usually when make all is called, |
56 | | -# then we publish everything to bookdown.org |
57 | | -if (length(formats) > 1 && !ghpages) { |
58 | | - message(">> Publishing Books") |
59 | | - if (!is.na(Sys.getenv("CI", NA))) { |
60 | | - # On CI connect to server, using API KEY and deploy using appId |
61 | | - rsconnect::addServer('https://bookdown.org', 'bookdown.org') |
62 | | - rsconnect::connectApiUser( |
63 | | - account = 'GHA', server = 'bookdown.org', |
64 | | - apiKey = Sys.getenv('CONNECT_API_KEY') |
65 | | - ) |
66 | | - rsconnect::deploySite( |
67 | | - appId = Sys.getenv('CONTENT_ID'), |
68 | | - server = 'bookdown.org', |
69 | | - render = 'none', logLevel = 'verbose', |
70 | | - forceUpdate = TRUE) |
71 | | - } else { |
72 | | - # for local deployment when rsconnect/ is available |
73 | | - bookdown::publish_book('bookdown', server = 'bookdown.org', render = 'none') |
74 | | - } |
75 | | -} |
76 | | - |
77 | 41 | setwd(owd) |
0 commit comments