RightCapital's centralized reusable GitHub Actions.
Create git tags and GitHub releases for an Nx-managed monorepo. Designed to run after a Release PR is merged to main.
What it does:
- Discovers all packages from the Nx release groups in
nx.json - Creates git tags for packages whose expected tag does not yet exist, and pushes them
- Creates GitHub releases with changelog notes extracted from each package's
CHANGELOG.md - Optionally publishes packages to npm via
nx release publish
| Input | Required | Default | Description |
|---|---|---|---|
token |
Yes | GitHub token used to create GitHub releases | |
create-release |
No | true |
Whether to create GitHub releases |
dry-run |
No | false |
Run without making any changes |
publish |
No | false |
Whether to publish packages to npm |
| Output | Description |
|---|---|
new-tags |
JSON array of newly created git tags |
published |
Whether packages were published to npm (true/false) |
published-packages |
JSON array of published packages (e.g. [{"name":"@scope/pkg","version":"1.0.0"}]) |
Create or update a release PR for an Nx-managed monorepo. Designed to run on push to main (when version plans exist).
What it does:
- Creates a release branch from
main - Reads version plan files from
.nx/version-plans/ - Runs
releaseVersion()andreleaseChangelog()from the Nx programmatic API to bump versions and generate changelogs - Updates the pnpm lockfile
- Commits, pushes to the release branch
- Creates a new PR (or updates an existing one) with a version table and grouped changes
| Input | Required | Default | Description |
|---|---|---|---|
release-branch |
No | release |
Branch name for the release PR |
base |
No | repo's default branch | Base branch for the PR (falls back to default branch) |
pr-title |
Yes | Pull request title | |
banner |
No | '' |
Markdown banner prepended to the PR body |
commit-message |
No | chore(release): prepare release |
Git commit message for the version bump |
label |
No | release |
Label to apply to the PR |
token |
Yes | GitHub token for git push and PR operations | |
git-user-name |
No | GitHub Actions[bot] |
Git user.name for the version bump commit |
git-user-email |
No | npm-publisher@rightcapital.com |
Git user.email for the version bump commit |
post-version-command |
No | '' |
Command to run after versioning, before committing. Receives NX_RELEASE_PR_BUMPED_PACKAGES and NX_RELEASE_PR_PROJECT_PACKAGES env vars (JSON arrays of {name, version, oldVersion}) |
| Output | Description |
|---|---|
pr-url |
URL of the created or updated PR |
pr-number |
Number of the created or updated PR |
bumped-packages |
JSON array of bumped packages ([{name, version, oldVersion}]) |
project-packages |
JSON array of all project packages ([{name, version, oldVersion}]) |
Auto-generate Nx version plans from commit bump headers. Designed to run on Renovate PRs (or any PR whose commits contain a bump type header).
What it does:
- Parses the HEAD commit message for an
Nx-version-bump: <type>header (e.g.,Nx-version-bump: patch) - Runs
nx release plan <type>to generate a version plan file - Amends the commit with the version plan added and the bump header stripped
- Force-pushes the amended commit (triggers CI re-run)
| Input | Required | Default | Description |
|---|---|---|---|
bump-header |
No | Nx-version-bump: |
Commit message header prefix for bump detection |
| Output | Description |
|---|---|
amended |
Whether the commit was amended (true if version plan was generated or header stripped) |
bump-type |
The detected bump type (patch, minor, major, none, or empty if no header) |
Developer creates version plan ──► Feature PR merged to main
│
▼
release-pr workflow
(nx-release-pr action)
│
▼
Release PR created/updated
(release → main)
│
▼
Maintainer merges PR
│
▼
release workflow
(nx-release action)
│
▼
Git tags + GitHub releases created
(+ optional npm publish)
- Create a version plan: On a feature branch, run
pnpm -w change(ornx release plan) to create a version plan file in.nx/version-plans/. The file specifies which packages to bump and by how much. Commit it alongside your changes. - Merge feature PR: When version plans land on
main(via merged feature PRs), the Release PR workflow runsnx-release-prto create or update a Release PR on thereleasebranch. - Review and merge: The Release PR shows a version table and grouped changes. Merge it to
mainwhen ready. - Release: When the Release PR is merged, the Release workflow runs
nx-releaseto create git tags, GitHub releases, and optionally publish to npm.
Version plans are markdown files in .nx/version-plans/ with YAML front matter:
---
nx-release: minor
---
Add support for custom changelog renderersBump values: major, minor, patch. For fixed release groups, use the group name instead of individual project names.
The simplest way to adopt the nx release flow. Add two workflow files to your repo:
.github/workflows/release-pr.yml:
name: Release PR
on:
push:
branches: [main]
workflow_dispatch:
jobs:
release-pr:
uses: rightcapitalhq/actions/.github/workflows/nx-release-pr.yml@nx-release-pr/v1
secrets: inherit.github/workflows/release.yml:
name: Release
on:
pull_request:
types: [closed]
branches: [main]
jobs:
release:
if: >-
github.event.pull_request.merged == true
&& github.event.pull_request.head.ref == 'release'
uses: rightcapitalhq/actions/.github/workflows/nx-release.yml@nx-release/v1
secrets: inheritTo also publish packages to npm, pass publish: true:
uses: rightcapitalhq/actions/.github/workflows/nx-release.yml@nx-release/v1
with:
publish: true
secrets: inherit.github/workflows/renovate-auto-plan.yml (optional, for auto-generating version plans on Renovate PRs):
name: Renovate Auto Plan
on:
pull_request:
branches: [main]
jobs:
auto-plan:
if: startsWith(github.event.pull_request.head.ref, 'renovate/')
uses: rightcapitalhq/actions/.github/workflows/nx-release-auto-plan.yml@nx-release/v1
secrets: inheritThe reusable workflows handle checkout, pnpm/node setup, dependency installation, and action invocation. They use secrets.RC_BOT_APP_ID and secrets.RC_BOT_PRIVATE_KEY (org-level secrets) to generate a GitHub App installation token via actions/create-github-app-token. The git committer identity is automatically derived from the app.
For more control, reference the actions directly in your workflows. Generate a GitHub App token first, then pass it to the actions:
# Generate a token (add this step before using the actions):
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.RC_BOT_APP_ID }}
private-key: ${{ secrets.RC_BOT_PRIVATE_KEY }}
# In your release-pr workflow:
- uses: rightcapitalhq/actions/nx-release-pr@nx-release-pr/v1
with:
pr-title: 'chore(release): release packages'
token: ${{ steps.app-token.outputs.token }}
git-user-name: '${{ steps.app-token.outputs.app-slug }}[bot]'
# In your release workflow:
- uses: rightcapitalhq/actions/nx-release@nx-release/v1
with:
token: ${{ steps.app-token.outputs.token }}Your repo must have:
-
nxas a project dependency, with release groups configured innx.json:{ "release": { "groups": { "my-group": { "projects": ["package-a", "package-b"], "projectsRelationship": "fixed" } }, "versionPlans": true, "changelog": { "projectChangelogs": true, "workspaceChangelog": false }, "releaseTag": { "pattern": "{projectName}/v{version}" } } } -
pnpm as the package manager (with
pnpm-workspace.yaml) -
GitHub App — the reusable workflows authenticate using a GitHub App via org-level secrets
RC_BOT_APP_IDandRC_BOT_PRIVATE_KEY. The app needs Contents (Read & Write) and Pull Requests (Read & Write) permissions. Callers pass these secrets viasecrets: inherit. Theid-token: writeworkflow permission (set automatically by the reusable workflows) enables npm trusted publishing (OIDC provenance) whenpublish: trueis used — no npm token secret is needed
pnpm install
pnpm run buildBoth actions are built with rslib into a single CJS bundle at dist/index.js. CJS is used instead of ESM because signal-exit (a transitive dependency) causes TDZ errors under ESM scope hoisting. All dependencies are bundled except nx, which is externalized.
pnpm -w changeThis creates a version plan file in .nx/version-plans/. Commit it with your changes.
- Precise version tags:
nx-release/v1.0.0(created by the nx-release action) - Major version tags:
nx-release/v1(updated byscripts/update-major-tags.tspost-release) - All three actions (
nx-release,nx-release-pr,nx-release-auto-plan) are in a fixed release group — they always share the same version - Tags use
/instead of@as separator because the GitHub Actions runner splitsuses:on@, making@-containing refs ambiguous. Renovate also supports/-separated tags