@@ -49,35 +49,49 @@ release_gh <- function(bump = "dev", is_cran = bump != "dev") {
4949 sys_call(" git" , glue :: glue(' tag -a {new_version} -m "{msg}"' ))
5050 sys_call(" ./inst/consistent-release-tag" , " --release-mode" )
5151 usethis :: ui_done(" Tagged last commit with release version." )
52- sys_call(" git" , glue :: glue(" push --tags" ),
53- env = " SKIP=consistent-release-tag"
54- )
52+ if (! is_cran ) {
53+ sys_call(" git" , glue :: glue(" push origin {new_version}" ),
54+ env = " SKIP=consistent-release-tag"
55+ )
56+ }
57+
5558 sys_call(" git" , glue :: glue(" push" ),
5659 env = " SKIP=consistent-release-tag"
5760 )
5861 usethis :: ui_done(" Pushed commits and tags." )
5962 if (is_cran ) {
6063 usethis :: ui_info(paste(
61- " Once on CRAN, call `precommit::release_complete()` to bump to the devel" ,
64+ " Once on CRAN, call `precommit::release_complete(is_cran = TRUE )` to bump to the devel" ,
6265 " version."
6366 ))
6467 } else {
65- release_complete(ask = FALSE )
68+ release_complete(ask = FALSE , tag = new_version , is_cran = FALSE )
6669 }
6770}
6871
6972# ' Complete the release
7073# '
7174# ' Bumps the version to devel.
75+ # ' @param tag The tag to push. `NULL` will derive the tag from `DESCRIPTION`.
7276# ' @keywords internal
73- release_complete <- function (ask = TRUE ) {
77+ release_complete <- function (ask = TRUE , is_cran = ask , tag = NULL ) {
7478 if (git_branch_get() != " master" ) {
7579 rlang :: abort(" Must be on master to complete the release." )
7680 }
7781 if (ask ) {
7882 abort_if_not_yes(" Did you merge the release branch into master?" )
7983 abort_if_not_yes(" Did you pull the latest master from origin?" )
8084 }
85+ if (is_cran ) {
86+ if (is.null(tag )) {
87+ tag <- paste0(" v" , desc :: desc_get_version())
88+ }
89+ if (substr(tag , 1 , 1 ) == " v" ) {
90+ rlang :: abort(" tag must start with v." )
91+ }
92+ sys_call(" git" , glue :: glue(" push {tag}" ))
93+ }
94+
8195 precommit :: autoupdate() # only updates if tag is on the master branch
8296 desc :: desc_bump_version(" dev" )
8397 usethis :: ui_done(" Bumped version to dev" )
0 commit comments