Skip to content

Commit

Permalink
build: Add a renaming script for CI release uplaoding
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Sajid Imami <[email protected]>
  • Loading branch information
AliSajid committed May 10, 2024
1 parent d58c089 commit affd800
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions utilities/bump-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -euo pipefail

# Get the commit message of the latest commit
commit_message=$(git log -1 --pretty=%B)
Expand Down
38 changes: 38 additions & 0 deletions utilities/rename-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env Rscript

# This script takes in a name and renames it to include the current R
# version and the current platform. It is intended to be used to rename
# packages that are being uploaded to releases on GitHub.

## Parse the first argument as the package name + package version
args <- commandArgs(trailingOnly = TRUE)
if (length(args) != 1L) {
stop("Usage: rename-package.R <package-name>")
}

message("Received package name: ", args[[1L]])

packageName <- strsplit(args, "_")[[1L]][[1L]]
message("Package name: ", packageName)
packageVersion <- strsplit(args, "_")[[1L]][[2L]]
message("Package version: ", packageVersion)

newName <- paste(
packageName, paste("R",
getRversion(),
sep = "-"
),
R.version[["platform"]],
paste0("v", packageVersion),
sep = "_"
)

message("Renaming package to: ", newName)

value <- file.rename(args[[1L]], newName)

if (value) {
message("Successfully renamed package to: ", newName)
} else {
stop("Failed to rename package to: ", newName)
}

0 comments on commit affd800

Please sign in to comment.