Skip to content

Add CRAN submission workflow triggered on release - #60

Open
ChrisRackauckas wants to merge 1 commit into
masterfrom
add-cran-submission-workflow
Open

Add CRAN submission workflow triggered on release#60
ChrisRackauckas wants to merge 1 commit into
masterfrom
add-cran-submission-workflow

Conversation

@ChrisRackauckas

Copy link
Copy Markdown
Member

Summary

Adds .github/workflows/cran-release.yml that, on a published GitHub release:

  1. Builds the source tarball with R CMD build
  2. Runs R CMD check --as-cran
  3. Attaches the tarball to the GitHub release as an asset
  4. Calls devtools::submit_cran() to POST the tarball to CRAN

CRAN 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_dispatch trigger 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-submission with required reviewers (yourself):

  • Repo Settings → Environments → New environment → name cran-submission
  • Configure "Required reviewers" → add your GitHub user
  • Save

Why 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

  • Pre-releases are skipped (!github.event.release.prerelease).
  • cran-comments.md already exists in the repo — devtools::submit_cran() will use it.
  • The CRAN-SUBMISSION file 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.
  • TinyTeX is installed so the PDF manual builds during R CMD check.

Test plan

  • Create cran-submission environment with required reviewers
  • Trigger via workflow_dispatch once to validate build + check pass (cancel before approving the submit step, or let it submit if you're ready)
  • Next real release: cut tag v2.1.0, approve the pending workflow run, click the CRAN confirmation email

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant