Skip to content

Commit

Permalink
Automate release process (#97)
Browse files Browse the repository at this point in the history
### Changes
* Added automated release workflow to step through most of
https://github.com/pdil/usmap/wiki/🚀-Release-Process
* Once active, this will allow most of the manual release work to be
performed and added to an automated pull request.
* The pull request will allow maintainers to review changes and release
the package without having to do all of the required steps.
* The pull request will include pre and post release checklists to
ensure all steps are performed.
* Added spelling check

### Notes
* The changes in this pull request are non-destructive and do not
actually submit the package to CRAN so it can be tested freely.
* This pull request must be merged before it can be tested since it uses
a `workflow_dispatch` workflow.
* After merging, a new pull request will be opened with any ongoing
fixes required to make it fully functional.
  • Loading branch information
pdil authored Mar 17, 2024
2 parents 486979f + 9111b5e commit 6e583e8
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release-checklist.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
release_checklist <- function(version) {
# Platform checks
devtools::check_rhub(interactive = FALSE)
devtools::check_win_devel()

# Reverse dependency checks
revdepcheck::revdep_reset()
revdepcheck::revdep_check()

# Version number updates
desc::desc_set_version(version)
}
23 changes: 23 additions & 0 deletions .github/workflows/release-pr-body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
`usmap v${{ inputs.version }}` release candidate

#### Pre-release checklist:
- [ ] Review automated changes
- [ ] Review rhub and win_devel checks (see maintainer email for results)
- [ ] Review reverse dependency checks
- [ ] Review check and test results
- [ ] Verify `DESCRIPTION` and `NEWS.md` are accurate
- [ ] Update `cran-comments.md` if necessary
- [ ] Update `NEWS` if necessary
- [ ] Run `devtools::release()` from this branch
- [ ] Perform necessary CRAN verification release steps (see maintainer email)
Wait for CRAN to publish package. If issues are reported, make changes in this PR and re-run `devtools::release()`.

#### Post-release checklist:
- [ ] `git tag v{{ $inputs.version }}`
- [ ] `git push --tags`
- [ ] Update `DESCRIPTION` and `NEWS.md` versions to `{{ $inputs.version }}.9000`
- [ ] Add release date of latest version to `NEWS.md`
- Example `Released Monday, February 31, 2020.`
- [ ] Commit changes with message `Prepare for next release`
- [ ] `usethis::use_github_release()`
- Merge this PR
58 changes: 58 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

name: release

on:
workflow_dispatch:
inputs:
version:
description: "The version number for new release, e.g. 1.0.2"
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::desc
any::devtools
any::revdepcheck
- name: Run release checks
env:
VERSION: ${{ inputs.version }}
run: |
source(".github/workflows/release-checklist.R")
release_checklist(Sys.getenv("VERSION"))
shell: Rscript {0}

- name: Update NEWS.md version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "[unreleased]"
replace: "usmap ${{ inputs.version }}"
include: "NEWS.md"
regex: false

- name: Open pull request
id: open-pr
uses: peter-evans/create-pull-request@v5
with:
commit-message: "[automated] Prepare for ${{ inputs.version }} release"
branch: release/${{ inputs.version }}
title: Release version ${{ inputs.version }}
body-path: .github/workflows/release-pr-body.md
reviewers: pdil
assignees: pdil
labels: release
delete-branch: true
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Suggests:
rmarkdown,
scales,
sf,
spelling,
testthat (>= 3.0.0),
vdiffr
RoxygenNote: 7.3.1
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
#' Earthquakes (2019)
#'
#' @description US earthquakes with a magnitude of 2.5 or greater, occurring in the
#' first half of 2019, from January 1st to June 30th, from USGS.\cr\cr
#' first half of 2019, from January 1 to June 30, from USGS.\cr\cr
#' The data is formatted for transforming with [usmap::usmap_transform()].
#' Once the longitude and latitude is transformed, it can be added to
#' [usmap::plot_usmap()] using [ggplot2::ggplot()] layers.
Expand Down
2 changes: 1 addition & 1 deletion R/usmap-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' pertaining to a FIPS code.
#'
#' Likewise a reverse lookup can be done where a FIPS code can be used to
#' retrieve the associated state(s) or county(ies). This can be useful when
#' retrieve the associated states or counties. This can be useful when
#' preparing data to be merged with the map data frame.
#'
#' @section Plot US map data:
Expand Down
29 changes: 29 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Albers
Bartholemew
CRS
Cordova
DCW
Esri
Factbook
Geospatial
Grosvenor
Kusilvak
MULTILINESTRING
McNally
NGA
README
Rud
Rudis
USGS
Vectorization
Vectorize
choropleth
choropleths
codecov
expandability
fips
ggplot
ggthemes
github
usmapdata
2 changes: 1 addition & 1 deletion man/earthquakes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/usmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/spelling.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if (requireNamespace("spelling", quietly = TRUE))
spelling::spell_check_test(
vignettes = TRUE,
error = FALSE,
skip_on_cran = TRUE
)

0 comments on commit 6e583e8

Please sign in to comment.