Skip to content

Commit 1c70e59

Browse files
authored
Deprecate release() in favour of usethis::use_release_issue() (#2646)
Fixes #2500
1 parent 0a5e621 commit 1c70e59

7 files changed

Lines changed: 57 additions & 66 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* `dev_sitrep()` now works correctly in Positron (#2618).
77
* `is_loading()` is now re-exported from pkgload (#2556).
88
* `load_all()` now errors if called recursively, i.e. if you accidentally include a `load_all()` call in one of your R source files (#2617).
9+
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
910
* `show_news()` now looks for NEWS files in the same locations as `utils::news()`: `inst/NEWS.Rd`, `NEWS.md`, `NEWS`, and `inst/NEWS` (@arcresu, #2499).
1011

1112
# devtools 2.4.6

R/release.R

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
#' Release package to CRAN.
22
#'
3-
#' Run automated and manual tests, then post package to CRAN.
4-
#'
5-
#' The package release process will:
6-
#'
7-
#' * Confirm that the package passes `R CMD check` on relevant platforms
8-
#' * Confirm that important files are up-to-date
9-
#' * Build the package
10-
#' * Submit the package to CRAN, using comments in "cran-comments.md"
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
115
#'
12-
#' You can add arbitrary extra questions by defining an (un-exported) function
13-
#' called `release_questions()` that returns a character vector
14-
#' of additional questions to ask.
6+
#' `release()` is deprecated in favour of [usethis::use_release_issue()].
7+
#' We no longer feel confident recommending `release()` because we don't use it
8+
#' ourselves, so there's no guarantee that it will track best practices as
9+
#' they evolve over time.
1510
#'
16-
#' You also need to read the CRAN repository policy at
17-
#' 'https://cran.r-project.org/web/packages/policies.html' and make
18-
#' sure you're in line with the policies. `release` tries to automate as
19-
#' many of polices as possible, but it's impossible to be completely
20-
#' comprehensive, and they do change in between releases of devtools.
11+
#' If you want to programmatical submit to CRAN, you can continue to use
12+
#' [submit_cran()].
2113
#'
2214
#' @template devtools
2315
#' @param check if `TRUE`, run checking, otherwise omit it. This
@@ -29,6 +21,15 @@
2921
#' tasks that you can use in addition to or in place of `release`.
3022
#' @export
3123
release <- function(pkg = ".", check = FALSE, args = NULL) {
24+
lifecycle::deprecate_warn(
25+
"2.5.0",
26+
"release()",
27+
"usethis::use_release_issue()"
28+
)
29+
if (!rlang::is_interactive()) {
30+
cli::cli_abort("Interactive session required.")
31+
}
32+
3233
pkg <- as.package(pkg)
3334
# Figure out if this is a new package
3435
cran_version <- cran_pkg_version(pkg$package)
@@ -159,6 +160,10 @@ find_release_questions <- function(pkg = ".") {
159160
}
160161

161162
yesno <- function(msg, .envir = parent.frame()) {
163+
if (!rlang::is_interactive()) {
164+
cli::cli_abort("Called from non-interactive context.")
165+
}
166+
162167
yeses <- c(
163168
"Yes",
164169
"Definitely",
@@ -226,23 +231,13 @@ cran_submission_url <- "https://xmpalantir.wu.ac.at/cransubmit/index2.php"
226231
#' Submit a package to CRAN
227232
#'
228233
#' @description
229-
230234
#' This submits your package to CRAN using the web-form submission process.
231-
#' After submission, you will receive an email asking you to confirm submission
232-
#' - this is used to check that the package is submitted by the maintainer.
233-
#'
234-
#' You may prefer to use `submit_cran()` indirectly, by calling [release()]
235-
#' instead. `release()` performs many checks verifying that your package is
236-
#' indeed ready for CRAN, before eventually asking for your confirmation that
237-
#' you'd like to submit it to CRAN (which it does by calling `submit_cran()`).
235+
#' To complete the submission you will need respond to the email sent to the
236+
#' maintainer email address.
238237
#'
239-
#' Whether to use `release()` or `submit_cran()` depends on the rest of your
240-
#' development process. If you want to be super cautious, use `release()`, even
241-
#' though it may be redundant with other checks you have performed. On the other
242-
#' hand, if you have many other checks in place (such as automated checks via
243-
#' GitHub Actions and the task list generated by
244-
#' [usethis::use_release_issue()]), it makes sense to use `submit_cran()`
245-
#' directly.
238+
#' We generally recommend using this part of the process defined by
239+
#' [use_release_issue()]; this process maximizes the chances of a successful
240+
#' submission.
246241
#'
247242
#' @template devtools
248243
#' @inheritParams release

_pkgdown.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ reference:
2626
- document
2727
- load_all
2828
- reload
29-
- release
3029
- spell_check
3130
- test
3231
- title: Package Installation
@@ -49,6 +48,10 @@ reference:
4948
- wd
5049
- save_all
5150

51+
- title: Deprecated functions
52+
contents:
53+
- release
54+
5255
news:
5356
releases:
5457
- text: "Version 2.2.1"

man/release.Rd

Lines changed: 7 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/submit_cran.Rd

Lines changed: 5 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/release.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# release() is deprecated
2+
3+
Code
4+
. <- release()
5+
Condition
6+
Warning:
7+
`release()` was deprecated in devtools 2.5.0.
8+
i Please use `usethis::use_release_issue()` instead.
9+
Error in `release()`:
10+
! Interactive session required.
11+

tests/testthat/test-release.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test_that("release() is deprecated", {
2+
expect_snapshot(. <- release(), error = TRUE)
3+
})

0 commit comments

Comments
 (0)