Sure! To set up release-please to publish multiple packages from a pnpm monorepo to npm using GitHub Actions, we'll need to:
Configure release-please to handle each package separately.
Use release-please-action in GitHub Actions for each package.
Ensure proper version bumps and publishing via changesets, lerna, or native package.json + npm publish.
Since you're using a pnpm monorepo , the most compatible method with release-please is to use per-package changelogs and native npm version/npm publish (or optionally integrate with changesets if desired). Below is a working setup using native changelog-based releases .
✅ Option 1: Per-Package Release Please Setup (Recommended for pnpm)
📁 Directory Structure
code Copy code
monorepo-root/
├── packages/
│ ├── client/
│ │ ├── package.json
│ │ └── CHANGELOG.md
│ └── types/
│ ├── package.json
│ └── CHANGELOG.md
├── .github/
│ └── workflows/
│ ├── release-client.yml
│ └── release-types.yml
Each package must:
Have its own CHANGELOG.md.
Be independently versioned and published to npm.
🔧 Step-by-step Setup
1. Enable GitHub Token Permissions
Make sure your GitHub token (used in workflow) has repo and write:packages scope (for private packages).
2. Create Release Workflow per Package
📄 .github/workflows/release-client.yml
yaml Copy code
name: Release Client Package
on:
push:
branches: [main]
pull_request:
types: [closed]
branches: [main]
jobs:
release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for release-please to generate changelog
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Run release-please for client
uses: release-please/release-please-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
package-name: client
release-type: node
changelog-path: packages/client/CHANGELOG.md
manifest-path: packages/client/package.json
commit-message: 'chore(client): release %s'
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
- name: Publish client package to npm
if: github.ref == 'refs/heads/main'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/client
npm publish --access public
📄 .github/workflows/release-types.yml
Duplicate the above file and modify for the types package:
yaml Copy code
# .github/workflows/release-types.yml
name: Release Types Package
on:
push:
branches: [main]
pull_request:
types: [closed]
branches: [main]
jobs:
release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Run release-please for types
uses: release-please/release-please-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
package-name: types
release-type: node
changelog-path: packages/types/CHANGELOG.md
manifest-path: packages/types/package.json
commit-message: 'chore(types): release %s'
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
- name: Publish types package to npm
if: github.ref == 'refs/heads/main'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/types
npm publish --access public
3. Secrets Required
In your repo → Settings → Secrets & variables → Actions:
🛠 Alternative: Use Changesets (Optional)
If you prefer coordinated semver bumps across packages, consider using @changesets/cli . You'd then:
Use one GitHub Action to run changeset version + pnpm install + pnpm publish for changed packages.
Automate changelog generation and version bumps together.
But that’s a different setup — let me know if you want that instead.
✅ Verify
Once merged into main, the workflow will:
Generate changelog.
Bump version in package.json.
Commit and tag the release.
Publish to npm.
🎉 Done!
Would you like help setting up a single combined release workflow too?