-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#' Bump version based on version instructions in commit | ||
#' or automatically for cron jobs | ||
#' @param commit latest commit | ||
#' @param cron is it a cron job (logical) | ||
#' @param changes are there any changed files (logical) | ||
#' | ||
|
||
bump_version <- function(commit, cron, changes) { | ||
|
||
current_ver <- semver::parse_version(readLines("version.txt")) | ||
|
||
if (cron==TRUE) { | ||
if (changes==TRUE) { # for cron jobs, only bump if update_data.R resulted in changed files | ||
# Cron job with new data, increment minor version | ||
new_ver <- semver::increment_version(current_ver, "minor", 1L) | ||
} | ||
} else { # this is triggered by an update to Main or by a PR on a branch | ||
# parse the most recent commit for version instructions | ||
|
||
if (grepl("\\[no version bump\\]", commit, ignore.case = TRUE)) | ||
{ | ||
new_ver <- current_ver | ||
paste("No version bump") | ||
} else if (grepl("\\[major\\]", commit, ignore.case = TRUE)) { | ||
new_ver <- semver::increment_version(current_ver, "major", 1L) | ||
print("Bumping major version") | ||
} else if (grepl("\\[minor\\]", commit, ignore.case = TRUE)) { | ||
new_ver <- semver::increment_version(current_ver, "minor", 1L) | ||
print("Bumping minor version") | ||
} else if (grepl("\\[patch\\]", commit, ignore.case = TRUE)) { | ||
new_ver <- semver::increment_version(current_ver, "patch", 1L) | ||
print("Bumping patch version") | ||
} else { | ||
stop(paste("The final commit message in a set of changes must be tagged", | ||
"with version increment information.\nOptions include", | ||
"[major], [minor], [patch], and [no version bump].\n", | ||
"The last commit in this set of changes is:\n", | ||
commit)) | ||
} | ||
} | ||
|
||
writeLines(as.character(new_ver), "version.txt") | ||
|
||
} |