Skip to content

Commit f9248de

Browse files
committed
feat(eds-core-react): add release-please automation
- Configure release-please for automatic versioning - Add trigger_publish workflow for automated publishing - Set up test branch for validation
1 parent 676c655 commit f9248de

6 files changed

Lines changed: 463 additions & 126 deletions

File tree

.github/release-please-config.md

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
# Release Please Configuration Documentation
2+
3+
This document explains the configuration in `.github/release-please-config.json`.
4+
5+
## Core Configuration
6+
7+
### Schema
8+
9+
```json
10+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
11+
```
12+
13+
Enables IDE autocomplete, validation, and inline documentation for the configuration file.
14+
15+
### Bootstrap SHA
16+
17+
```json
18+
"bootstrap-sha": "HEAD"
19+
```
20+
21+
Tells release-please to start tracking releases from the current HEAD commit. This is used when setting up release-please for the first time in an existing repository with release history.
22+
23+
### Tag Separator
24+
25+
```json
26+
"tag-separator": "@"
27+
```
28+
29+
Defines the separator used in git tags. With `@`, tags are formatted as `eds-core-react@0.49.0` instead of `eds-core-react-v0.49.0`. This matches our existing tag format in the repository.
30+
31+
## Package Configuration
32+
33+
Each package in the monorepo must be explicitly configured:
34+
35+
```json
36+
"packages/eds-core-react": {
37+
"release-type": "node",
38+
"package-name": "@equinor/eds-core-react",
39+
"component": "eds-core-react"
40+
}
41+
```
42+
43+
- **Path key** (`packages/eds-core-react`): The relative path from repo root to the package
44+
- **`release-type`**: Set to `"node"` for npm packages. This determines how version bumping works
45+
- **`package-name`**: The npm package name (with scope)
46+
- **`component`**: Used in git tags and must match the tag format. For `eds-core-react`, tags will be `eds-core-react@x.y.z`
47+
48+
### All Configured Packages
49+
50+
We currently track these packages for releases:
51+
52+
1. `@equinor/eds-core-react` - Core React component library
53+
2. `@equinor/eds-data-grid-react` - Data grid component
54+
3. `@equinor/eds-icons` - Icon library
55+
4. `@equinor/eds-lab-react` - Experimental components
56+
5. `@equinor/eds-tokens` - Design tokens and variables
57+
6. `@equinor/eds-utils` - Shared utilities
58+
59+
## Pull Request Configuration
60+
61+
### Combined Releases
62+
63+
```json
64+
"separate-pull-requests": false
65+
```
66+
67+
Creates **one combined PR** with all packages that have changes, rather than separate PRs per package. When this PR is merged, release-please will create separate GitHub releases for each package automatically.
68+
69+
### PR Title Pattern
70+
71+
```json
72+
"pull-request-title-pattern": "chore: release${component}"
73+
```
74+
75+
Defines the title format for release PRs. The `${component}` placeholder is replaced with package names. With combined PRs, this shows all affected components.
76+
77+
### PR Header
78+
79+
```json
80+
"pull-request-header": "## Release PR\n\nThis PR was automatically generated..."
81+
```
82+
83+
Custom message added to the top of release PRs. Used to provide instructions for what to do after merging.
84+
85+
### PR Label
86+
87+
```json
88+
"label": "autorelease: pending"
89+
```
90+
91+
Automatically adds this label to release PRs for easy filtering and identification.
92+
93+
## Changelog Configuration
94+
95+
### Changelog Sections
96+
97+
```json
98+
"changelog-sections": [
99+
{ "type": "feat", "section": "✨ Added" },
100+
{ "type": "fix", "section": "🐛 Fixed" },
101+
...
102+
]
103+
```
104+
105+
Maps conventional commit types to changelog sections with emojis:
106+
107+
- **feat** → ✨ Added (new features)
108+
- **fix** → 🐛 Fixed (bug fixes)
109+
- **docs** → 📝 Changed (documentation updates)
110+
- **perf** → ⚡ Performance Improvements
111+
- **refactor** → ♻️ Refactoring (code restructuring)
112+
- **chore** → 🔧 Chores (maintenance tasks, dependency updates)
113+
- **ci** → 👷 CI/CD (pipeline/workflow changes)
114+
- **build** → 📦 Build System (build configuration)
115+
- **test** → ✅ Tests (test additions/changes)
116+
117+
All types are visible in CHANGELOG files. Note: There's no `hidden` property, so all commit types appear in both CHANGELOGs and GitHub releases. (This is why we do Github Releases manually - to be able to filter out chores, CI/CD changes, and build system updates that are relevant for maintainers but not for end users.)
118+
119+
### Changelog Path
120+
121+
```json
122+
"changelog-path": "CHANGELOG.md"
123+
```
124+
125+
Relative path for the changelog file in each package. Release-please will create/update `packages/[package-name]/CHANGELOG.md`.
126+
127+
### Release Search Depth
128+
129+
```json
130+
"release-search-depth": 500
131+
```
132+
133+
How many commits back to search when looking for the last release. Increase this if you have a very long commit history between releases.
134+
135+
## Version Bumping Rules
136+
137+
### Pre-1.0.0 Behavior
138+
139+
```json
140+
"bump-minor-pre-major": true
141+
```
142+
143+
Before version 1.0.0, `feat:` commits bump the minor version (0.x.0) instead of major. This follows the convention that pre-1.0.0 versions are still in development.
144+
145+
```json
146+
"bump-patch-for-minor-pre-major": false
147+
```
148+
149+
Ensures that breaking changes (indicated by `BREAKING CHANGE:` in commit message) still bump minor version pre-1.0.0, not patch.
150+
151+
**Version Bump Examples (pre-1.0.0):**
152+
153+
- `fix: bug` → 0.1.0 → 0.1.1 (patch)
154+
- `feat: new feature` → 0.1.0 → 0.2.0 (minor)
155+
- `feat!: breaking change` → 0.1.0 → 0.2.0 (minor, not major)
156+
157+
**Version Bump Examples (1.0.0+):**
158+
159+
- `fix: bug` → 1.0.0 → 1.0.1 (patch)
160+
- `feat: new feature` → 1.0.0 → 1.1.0 (minor)
161+
- `feat!: breaking change` → 1.0.0 → 2.0.0 (major)
162+
163+
## GitHub Release Configuration
164+
165+
```json
166+
"skip-github-release": true
167+
```
168+
169+
When `true`, release-please will NOT automatically create GitHub releases when the release PR is merged. This means:
170+
171+
- Release PRs are created automatically ✅
172+
- Version bumps happen automatically ✅
173+
- CHANGELOGs are updated automatically ✅
174+
- GitHub releases must be created manually ❌
175+
176+
Set to `false` if you want automatic GitHub release creation.
177+
178+
## How It Works Together
179+
180+
1. **Developer makes conventional commits** (e.g., `feat(eds-icons): add new icon`)
181+
2. **Release-please monitors the branch** and detects releasable changes
182+
3. **Release PR is created** with:
183+
- Version bumps in affected `package.json` files
184+
- Updated CHANGELOGs for affected packages
185+
- Summary of all changes
186+
4. **Team reviews and merges the PR**
187+
5. **Automatic publish workflow triggers** (separate workflow)
188+
6. **Packages are published to npm**
189+
7. **GitHub releases are created manually** (because `skip-github-release: true`)
190+
191+
## Multi-Package Example
192+
193+
If you make these commits:
194+
195+
```bash
196+
feat(eds-icons): add arrow-up icon
197+
fix(eds-core-react): fix button padding
198+
feat(eds-tokens): add new color tokens
199+
```
200+
201+
Release-please will create ONE PR that:
202+
203+
- Bumps `eds-icons` from 0.22.0 → 0.23.0
204+
- Bumps `eds-core-react` from 0.49.0 → 0.50.0
205+
- Bumps `eds-tokens` from 0.10.0 → 0.11.0
206+
- Updates all three CHANGELOGs
207+
208+
When merged, three separate GitHub releases will be created (if `skip-github-release: false`).
209+
210+
## Commit Scope Matching
211+
212+
The `component` field must match commit scopes for release-please to detect which packages are affected:
213+
214+
```bash
215+
# These commits affect the corresponding packages:
216+
feat(eds-core-react): ... → packages/eds-core-react
217+
fix(eds-icons): ... → packages/eds-icons
218+
docs(eds-tokens): ... → packages/eds-tokens
219+
220+
# Multiple packages in one commit:
221+
feat(eds-icons, eds-core-react): ... → both packages
222+
```
223+
224+
## Related Files
225+
226+
- **Config**: `.github/release-please-config.json` (this documentation)
227+
- **Manifest**: `.github/release-please-manifest.json` (tracks current versions)
228+
- **Workflow**: `.github/workflows/release-please.yml` (triggers release-please)
229+
- **Publish**: `.github/workflows/trigger-publish.yml` (publishes after release)
230+
231+
## Useful Links
232+
233+
- [Release Please Documentation](https://github.com/googleapis/release-please)
234+
- [Conventional Commits](https://www.conventionalcommits.org/)
235+
- [Semantic Versioning](https://semver.org/)

.github/release-please-manifest.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
"packages/eds-icons": "0.22.0",
55
"packages/eds-lab-react": "0.7.9",
66
"packages/eds-tokens": "0.10.0",
7-
"packages/eds-tokens-build": "1.0.1",
8-
"packages/eds-tokens-sync": "1.0.1",
97
"packages/eds-utils": "0.9.0"
108
}

.github/workflows/release_please.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1+
# Release Please Workflow
2+
#
3+
# This workflow automates the release process by:
4+
# 1. Analyzing conventional commits since the last release
5+
# 2. Determining appropriate version bumps (major/minor/patch)
6+
# 3. Creating/updating a release PR with version bumps and CHANGELOGs
7+
# 4. Triggering automated npm publishing when the release PR is merged (trigger_publish.yml)
8+
#
9+
# Note: Release-please creates/updates ONE release PR that accumulates changes.
10+
# It does NOT create a release on every push - releases only happen when you merge the PR.
11+
112
name: Release Please
213

14+
# Trigger: Run on every push to develop branch
15+
# This keeps the release PR up-to-date with latest changes
316
on:
417
push:
518
branches:
619
# - develop # TODO: enable after testing
720
- fre/release-please # Test branch
821

22+
# Permissions required for release-please to function
923
permissions:
10-
contents: write
11-
pull-requests: write
24+
contents: write # Needed to: create releases, update files, create tags
25+
pull-requests: write # Needed to: create and update release PRs
1226

1327
jobs:
1428
release-please:
1529
runs-on: ubuntu-latest
30+
31+
# Expose outputs to make them available for other workflows
32+
# These outputs can be used by downstream jobs or workflows (like trigger-publish.yml)
33+
# Each package gets two outputs: whether it was released and what tag was created
1634
outputs:
35+
# Global: true if ANY package was released
1736
releases_created: ${{ steps.release.outputs.releases_created }}
37+
38+
# Per-package outputs for conditional logic in downstream workflows
1839
eds-core-react--release_created: ${{ steps.release.outputs['packages/eds-core-react--release_created'] }}
1940
eds-core-react--tag_name: ${{ steps.release.outputs['packages/eds-core-react--tag_name'] }}
2041
eds-data-grid-react--release_created: ${{ steps.release.outputs['packages/eds-data-grid-react--release_created'] }}
@@ -31,17 +52,29 @@ jobs:
3152
eds-tokens-sync--tag_name: ${{ steps.release.outputs['packages/eds-tokens-sync--tag_name'] }}
3253
eds-utils--release_created: ${{ steps.release.outputs['packages/eds-utils--release_created'] }}
3354
eds-utils--tag_name: ${{ steps.release.outputs['packages/eds-utils--tag_name'] }}
55+
3456
steps:
35-
- uses: google-github-actions/release-please-action@v4
36-
id: release
57+
# Main step: Run the release-please action
58+
# This does the heavy lifting of analyzing commits and managing releases
59+
- uses: googleapis/release-please-action@v4
60+
id: release # ID used to reference outputs in later steps
3761
with:
38-
target-branch: fre/release-please #TODO: remove after testing
39-
config-file: .github/release-please-config.json
40-
manifest-file: .github/release-please-manifest.json
62+
# TODO: remove after testing - specifies which branch to create PRs against
63+
# Normally this would be inferred from the branch that triggered the workflow
64+
target-branch: fre/release-please
65+
66+
# Configuration files that define release behavior
67+
config-file: .github/release-please-config.json # How to handle releases (version bumping, changelog format, etc.)
68+
manifest-file: .github/release-please-manifest.json # Tracks current version of each package. This is updated automatically by release-please.
69+
70+
# GitHub token for authentication
4171
token: ${{ secrets.GITHUB_TOKEN }}
4272

73+
# Debug step: Log all outputs when releases are actually created
74+
# Only runs when release PR is merged and releases are created
75+
# Useful for debugging and understanding what release-please did
4376
- name: Print release outputs for debugging
4477
if: ${{ steps.release.outputs.releases_created }}
4578
run: |
4679
echo "Releases created!"
47-
echo "${{ toJson(steps.release.outputs) }}"
80+
echo '${{ toJson(steps.release.outputs) }}'

0 commit comments

Comments
 (0)