Skip to content

Commit

Permalink
Update release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dklein-pik committed Dec 5, 2024
1 parent 1e6809b commit 062a01d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
13 changes: 7 additions & 6 deletions scripts/utils/postRelease.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# This script is part of a longer workflow described here
# https://gitlab.pik-potsdam.de/rse/rse-internal/-/wikis/PublishModel
# This script is part of a longer workflow.
# Before running this script please perform the steps described here
# https://gitlab.pik-potsdam.de/REMIND/remind-rse/-/wikis/How-to-create-a-REMIND-release

# in your fork switch to develop and execute this script in the main folder Rscript scripts/utils/postRelease.R

postRelease <- function() {
gert::git_fetch("upstream")
Expand All @@ -12,6 +15,8 @@ postRelease <- function() {
"",
"## [Unreleased]",
"",
"### input data/calibration",
"",
"### changed",
"-",
"",
Expand All @@ -29,10 +34,6 @@ postRelease <- function() {
sub(pattern = pattern, replacement = paste0(pattern, textToAdd), fixed = TRUE) |>
writeLines("CHANGELOG.md")

readLines("CITATION.cff") |>
sub(pattern = "^(version:.*)$", replacement = "\\1dev") |>
writeLines("CITATION.cff")

message("Please perform the following step manually:\n",
"git add -p\n",
"--> When done press ENTER to commit, push and create PR")
Expand Down
18 changes: 14 additions & 4 deletions scripts/utils/release.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This script is part of a longer workflow described here
# https://gitlab.pik-potsdam.de/rse/rse-internal/-/wikis/PublishModel
# This script is part of a longer workflow.
# Before running this script please perform the steps described here
# https://gitlab.pik-potsdam.de/REMIND/remind-rse/-/wikis/How-to-create-a-REMIND-release

# in your fork switch to temporary branch (e.g. release-candidate) and
# execute this script in the main folder Rscript scripts/utils/release.R x.y.z

release <- function(newVersion) {
if (Sys.which("sbatch") == "") {
Expand Down Expand Up @@ -59,15 +63,21 @@ release <- function(newVersion) {
cfg$input <- cfg$input[cfg$stopOnMissing]
gms::publish_data(cfg,target = "[email protected]:/remind/public")

message("Please perform the two following steps manually:\n",
"1. CHANGELOG.md: sort lines in each category: changed, added, removed, fixed; remove empty categories\n",
message("If not already done please perform the two following steps manually now:\n",
"1. CHANGELOG.md: sort lines in each category: input data/calibration, changed, added, removed, fixed; remove empty categories\n",
"2. git add -p\n",
"--> When done press ENTER to commit, push and create PR")
gms::getLine()

message("Committing and pushing changes")
gert::git_commit(paste("remind release", newVersion))
gert::git_push()

message("Creating tag")
tag <- paste0("v",newVersion)
git_tag_create(name = tag, message = "new tag", repo = ".")
git_tag_push(name = tag, repo = ".")

message("Creating a PR on GitHub")
# gh pr create --help
# --base branch The branch into which you want your code merged
Expand Down

0 comments on commit 062a01d

Please sign in to comment.