rp publish
rp publish scans the working tree (exactly like rp usages), resolves the Git context, and posts the snapshot to POST /v1/code-references. Use it for CI systems other than GitHub; on GitHub the Action does the same job.
rp publish --project web --api-token rpa_xxx
RP_API_TOKEN=rpa_xxx RP_PROJECT_KEY=web rp publish
Flags
| Flag | Description |
|---|---|
-p, --project <key> | Project key. Defaults to RP_PROJECT_KEY. |
--api-token <token> | Organisation API token. Defaults to RP_API_TOKEN or the stored login. |
--api-url <url> | API base URL (https://, or http:// for localhost). |
--provider github|gitlab|bitbucket | Source-control provider. Auto-detected when absent. |
--repository <owner/repo>, --branch <name>, --commit-sha <sha> | Override the detected Git context. |
--include, --exclude, --client-name, --match-pattern, --var-alias | Same as rp usages. |
--dry-run | Print what would be published (target, commit, reference and key counts) without contacting the API. Needs no token or project. |
--fail-on-unknown | Exit non-zero if the API reports keys that are not in the project. |
--max-references <n> | Error instead of sending more than n references. Defaults to 2000, the API's per-snapshot limit. |
--max-references is a client-side guard against runaway scans (for example a generated bundle that slipped past your excludes). It does not split a large snapshot into several requests.
CI detection
The repository, branch and commit are read from the CI environment:
| CI | Variables |
|---|---|
| GitHub Actions | GITHUB_REPOSITORY, GITHUB_HEAD_REF (pull requests) or GITHUB_REF_NAME, GITHUB_SHA |
| GitLab CI | CI_PROJECT_PATH, CI_COMMIT_REF_NAME, CI_COMMIT_SHA |
| Bitbucket Pipelines | BITBUCKET_REPO_FULL_NAME, BITBUCKET_BRANCH, BITBUCKET_COMMIT |
| CircleCI | CIRCLE_PROJECT_USERNAME/CIRCLE_PROJECT_REPONAME, CIRCLE_BRANCH, CIRCLE_SHA1 |
| Azure Pipelines | BUILD_REPOSITORY_NAME, SYSTEM_PULLREQUEST_SOURCEBRANCH or BUILD_SOURCEBRANCH, BUILD_SOURCEVERSION |
| Jenkins | GIT_URL, BRANCH_NAME or GIT_BRANCH, GIT_COMMIT |
Outside CI the values come from the local git checkout.
The provider sent to the API is always github, gitlab or bitbucket. For CircleCI and Jenkins it is inferred from the remote URL, for Azure Pipelines from BUILD_REPOSITORY_PROVIDER, and otherwise defaults to github. Pass --provider to override it.
Example: GitLab CI
redpennon-usages:
stage: .post
image: node:24-alpine
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- npm install -g @redpennon/cli
- rp publish --project $REDPENNON_PROJECT_KEY --fail-on-unknown