Add CRAN submission workflow triggered on release - #60
Open
ChrisRackauckas wants to merge 1 commit into
Open
Conversation
On a published (non-prerelease) GitHub release, builds the source tarball, runs R CMD check --as-cran, attaches the tarball to the release, and calls devtools::submit_cran() to initiate the CRAN submission. The job runs inside the `cran-submission` GitHub environment — when configured with required reviewers, this pauses for explicit maintainer approval before submitting. This protects against accidental re-submissions of the same version, which CRAN rejects. CRAN still emails a confirmation link to the maintainer (from DESCRIPTION); only the maintainer can finalize by clicking it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
.github/workflows/cran-release.ymlthat, on a published GitHub release:R CMD buildR CMD check --as-crandevtools::submit_cran()to POST the tarball to CRANCRAN then emails the maintainer (from
DESCRIPTION) a confirmation link. Clicking that link finalizes the submission — the workflow can't do this for you (and CRAN policy wouldn't want it to).Manual
workflow_dispatchtrigger is also available for ad-hoc submissions without cutting a new release.Required one-time setup before this works
Create a GitHub Environment named
cran-submissionwith required reviewers (yourself):cran-submissionWhy this matters: without the reviewer gate, every published release auto-submits to CRAN. CRAN rejects duplicate submissions of the same version, and accidental re-tags would burn submission slots. The environment gate pauses the workflow at the submission step until you click "Approve" in the Actions UI.
Notes
!github.event.release.prerelease).cran-comments.mdalready exists in the repo —devtools::submit_cran()will use it.CRAN-SUBMISSIONfile written by devtools is logged in the run output. If you want it committed back to the repo automatically, that's a follow-up — for now you can copy it from the run log.R CMD check.Test plan
cran-submissionenvironment with required reviewersworkflow_dispatchonce to validate build + check pass (cancel before approving the submit step, or let it submit if you're ready)🤖 Generated with Claude Code