CI/CD Setup
This guide explains how to set up the GitHub Actions secrets required for the automated release pipeline. Without these secrets, the release workflow will fail.
Required Secrets
Section titled “Required Secrets”The release workflow requires the following secrets to be configured in your repository:
1. GitHub App Token (Required for Release)
Section titled “1. GitHub App Token (Required for Release)”The release workflow uses a GitHub App instead of GITHUB_TOKEN to create release pull requests. This is required because GitHub’s built-in GITHUB_TOKEN cannot trigger other workflows when creating PRs — meaning CI checks would wait forever.
Step 1: Create a GitHub App
Section titled “Step 1: Create a GitHub App”- Go to your repository or organization settings:
- Repository:
Settings → Developer settings → GitHub Apps → New GitHub App - Organization:
Settings → Developer settings → GitHub Apps → New GitHub App
- Repository:
- Fill in the app details:
- GitHub App name: Any name (e.g.,
ci-botorrelease-bot) - Homepage URL: Your repository URL
- Callback URL:
https://localhost(not used, but required)
- GitHub App name: Any name (e.g.,
- Permissions:
- Repository permissions:
- Contents: Read & write
- Pull requests: Read & write
- Metadata: Read-only
- Repository permissions:
- Events: No events needed (uncheck all)
- Permissions & events: Save
- Webhook: Disable webhook (uncheck “Active”)
- Click Create GitHub App
- Immediately scroll down to Private keys and click Generate a private key
- Download the
.pemfile — you will need its content
- Download the
Step 2: Add the App to Your Repository
Section titled “Step 2: Add the App to Your Repository”- Go to your repository
Settings → Install apps - Find your newly created app and click Install app
- Select All repositories or Only select repositories and choose your repo
Step 3: Get the App ID
Section titled “Step 3: Get the App ID”- Go back to your GitHub App settings page
- Copy the App ID (a number, e.g.,
123456)
Step 4: Add Secrets to Your Repository
Section titled “Step 4: Add Secrets to Your Repository”- Go to your repository
Settings → Secrets and variables → Actions - Add two secrets:
| Secret Name | Value |
|---|---|
APP_ID |
The App ID number from step 3 |
APP_PRIVATE_KEY |
The entire content of the .pem file (including -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY-----) |
Tip: If you use the same GitHub App across multiple repositories in an organization, add the secrets at the organization level instead:
Organization settings → Settings → Actions → Secrets and variables → Actions
2. crates.io Publishing (Optional)
Section titled “2. crates.io Publishing (Optional)”If you want to publish to crates.io:
| Secret Name | Value |
|---|---|
CARGO_REGISTRY_TOKEN |
Your crates.io API token from crates.io/me |
3. npm Publishing (Optional)
Section titled “3. npm Publishing (Optional)”If you want to publish the npm wrapper packages:
| Secret Name | Value |
|---|---|
NPM_TOKEN |
Your npm access token from npm Settings → Tokens |
4. Docker Hub Publishing (Optional)
Section titled “4. Docker Hub Publishing (Optional)”If you want to push Docker images to Docker Hub:
| Secret Name | Value |
|---|---|
DOCKERHUB_USERNAME |
Your Docker Hub username |
DOCKERHUB_TOKEN |
An access token from Docker Hub → Settings → Security |
How It Works
Section titled “How It Works”The release workflow uses actions/create-github-app-token to generate a short-lived token from the GitHub App credentials. This token is then passed to:
actions/checkout— so the checkout step can push commits and create PRsrelease-please-action— so release-please can create the release PR and merge it
Because the token belongs to a GitHub App (not the built-in GITHUB_TOKEN), the PRs it creates will trigger other workflows (such as the CI workflow), allowing status checks to pass normally.
Troubleshooting
Section titled “Troubleshooting”“Permissions denied” when creating the release PR
Section titled ““Permissions denied” when creating the release PR”- Verify the GitHub App is installed on the repository
- Verify the App has Contents: Read & write and Pull requests: Read & write permissions
- Verify
APP_IDandAPP_PRIVATE_KEYsecrets are correctly set
Release PR checks are still waiting
Section titled “Release PR checks are still waiting”- Ensure you are using the GitHub App token, not
GITHUB_TOKEN - Check that the CI workflow is not disabled:
Settings → Actions → General → Actions permissions
“Unable to access private key” error
Section titled ““Unable to access private key” error”- The
APP_PRIVATE_KEYsecret must contain the full.pemfile content, including the-----BEGIN...and-----END...lines - Do not add extra whitespace or newlines when pasting the secret
Using This Template in Your Own Project
Section titled “Using This Template in Your Own Project”When you create a new project from this template:
-
If you already have a GitHub App (e.g., shared across your organization’s repos), just add the same
APP_IDandAPP_PRIVATE_KEYsecrets to the new repository. -
If you don’t have a GitHub App, follow the steps above to create one. For organization-wide use, create the app at the organization level and add the secrets at the organization level.
-
Optional secrets (
CARGO_REGISTRY_TOKEN,NPM_TOKEN, Docker Hub secrets) are only needed if you want to publish to those platforms. The release workflow will skip those jobs if the secrets are missing.