Skip to content

Commit 2f411e9

Browse files
committed
ci(github): πŸ‘· Trigger automatic publish workflow (#4135)
* ci(github): πŸ‘· Trigger automatic publish after release-please-manifest changes * docs: πŸ“ Update release process docs * Remove unfit description * Deprecate old release docs
1 parent e530274 commit 2f411e9

File tree

6 files changed

+253
-112
lines changed

6 files changed

+253
-112
lines changed

β€Ž.github/release-please-config.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@
7979
"bump-minor-pre-major": true,
8080
"bump-patch-for-minor-pre-major": false,
8181
"pull-request-title-pattern": "chore: release${component}",
82-
"pull-request-header": "## Release PR\n\nThis PR was automatically generated by release-please.\n\nβœ… **What happens automatically when merged:**\n- πŸš€ npm publish workflows triggered for changed packages\n- πŸ“ Versions bumped and CHANGELOGs updated\n\n⚠️ **Manual steps required after merge:**\n1. Create GitHub releases (review CHANGELOGs and remove internal changes like chores, CI/CD, build system updates)\n2. Rebase master from develop\n3. Announce in #eds-design-system",
82+
"pull-request-header": "## Release PR\n\nThis PR was automatically generated by release-please.\n\nβœ… **What happens automatically when merged:**\n- πŸš€ npm publish workflows triggered for changed packages\n- πŸ“ Versions bumped and CHANGELOGs updated\n- 🏷️ GitHub releases created automatically\n\n⚠️ **Manual steps required after merge:**\n1. Rebase master from main\n2. Announce in #eds-design-system",
8383
"label": "autorelease: pending"
8484
}

β€Ž.github/release-please-config.mdβ€Ž

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,14 @@ Ensures that breaking changes (indicated by `BREAKING CHANGE:` in commit message
162162

163163
## GitHub Release Configuration
164164

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:
165+
By default, release-please automatically creates GitHub releases when the release PR is merged. This means:
170166

171167
- Release PRs are created automatically βœ…
172168
- Version bumps happen automatically βœ…
173169
- CHANGELOGs are updated automatically βœ…
174-
- GitHub releases must be created manually ❌
170+
- GitHub releases are created automatically βœ…
175171

176-
Set to `false` if you want automatic GitHub release creation.
172+
The releases include all commit types from the changelog (features, fixes, docs, chores, CI/CD, build system updates, etc.). If you want to skip automatic GitHub release creation, you can add `"skip-github-release": true` to the configuration.
177173

178174
## How It Works Together
179175

@@ -186,7 +182,7 @@ Set to `false` if you want automatic GitHub release creation.
186182
4. **Team reviews and merges the PR**
187183
5. **Automatic publish workflow triggers** (separate workflow)
188184
6. **Packages are published to npm**
189-
7. **GitHub releases are created manually** (because `skip-github-release: true`)
185+
7. **GitHub releases are created automatically**
190186

191187
## Multi-Package Example
192188

@@ -205,7 +201,7 @@ Release-please will create ONE PR that:
205201
- Bumps `eds-tokens` from 0.10.0 β†’ 0.11.0
206202
- Updates all three CHANGELOGs
207203

208-
When merged, three separate GitHub releases will be created (if `skip-github-release: false`).
204+
When merged, three separate GitHub releases will be created automatically.
209205

210206
## Commit Scope Matching
211207

@@ -227,6 +223,7 @@ feat(eds-icons, eds-core-react): ... β†’ both packages
227223
- **Manifest**: `.github/release-please-manifest.json` (tracks current versions)
228224
- **Workflow**: `.github/workflows/release-please.yml` (triggers release-please)
229225
- **Publish**: `.github/workflows/trigger-publish.yml` (publishes after release)
226+
- **Automated release documentation**: `../documentation/how-to/AUTOMATED_RELEASE.md`
230227

231228
## Useful Links
232229

β€Ž.github/workflows/trigger_publish.ymlβ€Ž

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Flow:
77
# 1. Release PR is merged β†’ this workflow runs
8-
# 2. Checks which package.json files changed
8+
# 2. Checks which package versions changed in .release-please-manifest.json
99
# 3. Triggers individual publish workflows only for changed packages
1010
# 4. Each publish workflow handles: building, testing, npm publish, and Storybook deployment
1111

@@ -19,7 +19,7 @@ on:
1919
branches:
2020
- main
2121
paths:
22-
- ".github/release-please-manifest.json"
22+
- '.github/release-please-manifest.json'
2323

2424
# Required permissions
2525
permissions:
@@ -53,7 +53,7 @@ jobs:
5353
echo "should-publish=true" >> $GITHUB_OUTPUT
5454
5555
# Job 1: Determine which packages need to be published
56-
# Checks git diff to see which package.json files changed in the merged PR
56+
# Checks the release-please-manifest.json to see which packages had version changes
5757
check-releases:
5858
needs: validate-release
5959
if: needs.validate-release.outputs.should-publish == 'true'
@@ -67,43 +67,35 @@ jobs:
6767
tokens: ${{ steps.check.outputs.tokens }}
6868

6969
steps:
70-
# Checkout the repository with full PR history
70+
# Checkout the repository - we only need the current state
7171
- name: Checkout
7272
uses: actions/checkout@v4
7373
with:
74-
fetch-depth: 0 # Fetch full history to ensure we can diff properly
74+
fetch-depth: 2 # Fetch last 2 commits to compare
7575

76-
# Check which package.json files were modified in the merge
77-
# For each package, sets output to 'true' if its package.json changed, 'false' otherwise
76+
# Check which packages had version changes in release-please-manifest.json
77+
# This is more reliable than checking package.json files directly
7878
- name: Check which packages changed
7979
id: check
8080
run: |
81-
# Use PR base and head SHAs for accurate diff
82-
# This works correctly regardless of merge strategy (squash/merge/rebase)
83-
# - base.sha: commit where PR branched from main
84-
# - head.sha: latest commit in PR branch before merge
85-
# This ensures we capture ALL changes in the PR, not just the merge commit
86-
BASE_SHA="${{ github.event.pull_request.base.sha }}"
87-
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
88-
8981
echo "## πŸ“ Detecting Package Changes" >> $GITHUB_STEP_SUMMARY
9082
echo "" >> $GITHUB_STEP_SUMMARY
91-
echo "Comparing: \`$BASE_SHA...$HEAD_SHA\`" >> $GITHUB_STEP_SUMMARY
83+
echo "Analyzing changes in .release-please-manifest.json" >> $GITHUB_STEP_SUMMARY
9284
echo "" >> $GITHUB_STEP_SUMMARY
9385
94-
# Get list of changed files
95-
CHANGED_FILES=$(git diff --name-only $BASE_SHA $HEAD_SHA)
86+
# Get the diff of the manifest file from the merge commit
87+
MANIFEST_DIFF=$(git diff HEAD^ HEAD -- .github/release-please-manifest.json)
9688
97-
echo "### Changed files:" >> $GITHUB_STEP_SUMMARY
98-
echo '```' >> $GITHUB_STEP_SUMMARY
99-
echo "$CHANGED_FILES" >> $GITHUB_STEP_SUMMARY
89+
echo "### Manifest changes:" >> $GITHUB_STEP_SUMMARY
90+
echo '```diff' >> $GITHUB_STEP_SUMMARY
91+
echo "$MANIFEST_DIFF" >> $GITHUB_STEP_SUMMARY
10092
echo '```' >> $GITHUB_STEP_SUMMARY
10193
echo "" >> $GITHUB_STEP_SUMMARY
10294
echo "### Package detection results:" >> $GITHUB_STEP_SUMMARY
10395
echo "" >> $GITHUB_STEP_SUMMARY
10496
10597
# Check eds-core-react
106-
if echo "$CHANGED_FILES" | grep -q "packages/eds-core-react/package.json"; then
98+
if echo "$MANIFEST_DIFF" | grep -q '"packages/eds-core-react":'; then
10799
echo "core-react=true" >> $GITHUB_OUTPUT
108100
echo "βœ… eds-core-react changed"
109101
echo "- βœ… **eds-core-react** changed" >> $GITHUB_STEP_SUMMARY
@@ -114,7 +106,7 @@ jobs:
114106
fi
115107
116108
# Check eds-lab-react
117-
if echo "$CHANGED_FILES" | grep -q "packages/eds-lab-react/package.json"; then
109+
if echo "$MANIFEST_DIFF" | grep -q '"packages/eds-lab-react":'; then
118110
echo "lab-react=true" >> $GITHUB_OUTPUT
119111
echo "βœ… eds-lab-react changed"
120112
echo "- βœ… **eds-lab-react** changed" >> $GITHUB_STEP_SUMMARY
@@ -125,7 +117,7 @@ jobs:
125117
fi
126118
127119
# Check eds-data-grid-react
128-
if echo "$CHANGED_FILES" | grep -q "packages/eds-data-grid-react/package.json"; then
120+
if echo "$MANIFEST_DIFF" | grep -q '"packages/eds-data-grid-react":'; then
129121
echo "data-grid-react=true" >> $GITHUB_OUTPUT
130122
echo "βœ… eds-data-grid-react changed"
131123
echo "- βœ… **eds-data-grid-react** changed" >> $GITHUB_STEP_SUMMARY
@@ -136,7 +128,7 @@ jobs:
136128
fi
137129
138130
# Check eds-icons
139-
if echo "$CHANGED_FILES" | grep -q "packages/eds-icons/package.json"; then
131+
if echo "$MANIFEST_DIFF" | grep -q '"packages/eds-icons":'; then
140132
echo "icons=true" >> $GITHUB_OUTPUT
141133
echo "βœ… eds-icons changed"
142134
echo "- βœ… **eds-icons** changed" >> $GITHUB_STEP_SUMMARY
@@ -147,7 +139,7 @@ jobs:
147139
fi
148140
149141
# Check eds-tokens
150-
if echo "$CHANGED_FILES" | grep -q "packages/eds-tokens/package.json"; then
142+
if echo "$MANIFEST_DIFF" | grep -q '"packages/eds-tokens":'; then
151143
echo "tokens=true" >> $GITHUB_OUTPUT
152144
echo "βœ… eds-tokens changed"
153145
echo "- βœ… **eds-tokens** changed" >> $GITHUB_STEP_SUMMARY
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# Automated Release Guide
2+
3+
Guide for the automated release process in Equinor Design System using Release Please and GitHub Actions.
4+
5+
## Table of Contents
6+
7+
- [Prerequisites](#prerequisites)
8+
- [Quick Start](#quick-start)
9+
- [How It Works](#how-it-works)
10+
- [Understanding Release PRs](#understanding-release-prs)
11+
- [Manual Steps After Release](#manual-steps-after-release)
12+
- [GitHub Releases](#github-releases)
13+
- [Troubleshooting](#troubleshooting)
14+
- [Configuration](#configuration)
15+
- [Resources](#resources)
16+
17+
## Quick Start
18+
19+
1. **Use conventional commits** during development (see [CONVENTIONAL_COMMITS.md](./CONVENTIONAL_COMMITS.md))
20+
- `feat(eds-core-react): add new button variant` β†’ minor version bump
21+
- `fix(eds-icons): correct icon alignment` β†’ patch version bump
22+
- `feat(eds-tokens)!: breaking change` β†’ major version bump
23+
24+
2. **Merge PR to `main`** β†’ Release Please automatically creates/updates a release PR
25+
26+
3. **Review the release PR**:
27+
- Check version bumps are appropriate
28+
- Verify CHANGELOG entries
29+
- Ensure all packages are included
30+
31+
4. **Merge the release PR** β†’ Automatic publishing begins
32+
33+
5. **Verify publishing** - Check GitHub Actions workflows complete successfully
34+
35+
6. **Update master branch** - Rebase `master` from `main`
36+
37+
7. **Announce release** - Post in `#eds-design-system` Slack channel
38+
39+
## How It Works
40+
41+
### Automated
42+
43+
- βœ… Version bumping
44+
- βœ… CHANGELOG generation
45+
- βœ… npm publishing
46+
- βœ… Git tag creation
47+
- βœ… GitHub releases
48+
49+
### Manual
50+
51+
- ⚠️ Rebasing master
52+
- ⚠️ Announcements
53+
54+
## Understanding Release PRs
55+
56+
When Release Please detects releasable changes, it creates a special PR with the title pattern "chore: release[component]". This PR contains:
57+
58+
### What's Included
59+
60+
- **Version bumps** in `package.json` files for affected packages
61+
- **Updated CHANGELOGs** with categorized commits (✨ Added, πŸ› Fixed, etc.)
62+
- **Release summary** showing all packages being released in the PR description
63+
64+
### How to Review
65+
66+
1. **Check version bumps** - Ensure semantic versioning is correct (especially important if there's breaking changes)
67+
2. **Review CHANGELOGs** - Verify all important changes are captured
68+
3. **Validate scope** - Confirm all affected packages are included
69+
4. **Test if needed** - Run tests or verify builds if uncertain
70+
71+
### When to Merge
72+
73+
- βœ… All automated checks pass
74+
- βœ… Version bumps look correct
75+
- βœ… No breaking changes without proper version bump
76+
- βœ… Ready to publish to npm and announce
77+
78+
### Important Notes
79+
80+
- **One PR for all packages** - Don't expect separate PRs per package
81+
- **Accumulative** - PR updates automatically with new commits until merged
82+
- - **No manual editing** - Don't edit the PR content manually; it will be overwritten
83+
84+
## Manual Steps After Release
85+
86+
While most of the release process is automated, these steps still need to be done manually:
87+
88+
### Update Master Branch
89+
90+
- Switch to the `master` branch:
91+
92+
```bash
93+
git checkout master
94+
```
95+
96+
- Rebase `master` with the latest changes from `main`:
97+
98+
```bash
99+
git rebase main
100+
```
101+
102+
- Push the updates to the remote repository:
103+
104+
```bash
105+
git push
106+
```
107+
108+
### Verify Release
109+
110+
- Verify the new version is available on [npmjs](https://www.npmjs.com/package/@equinor/eds-core-react?activeTab=versions).
111+
- Verify the new [storybook](https://storybook.eds.equinor.com/) is published.
112+
113+
### Announce Release
114+
115+
- Announce the release in #eds-design-system Slack channel
116+
- Leave out any chores, CI/CD changes, build system updates, and other internal changes that are not relevant to end users
117+
- Focus on user-facing features, fixes, and breaking changes
118+
119+
Here's a template for future release announcements:
120+
121+
---
122+
123+
We've just released:
124+
125+
- **[package-name-1] v[version-number-1]**
126+
- **[package-name-2] v[version-number-2]**
127+
128+
### **[Package-Name-1]:**
129+
130+
**Added**
131+
132+
- ✨ [Feature-1]: [Short description of the feature] by @[author]
133+
- ✨ [Feature-2]: [Short description of the feature] by @[author]
134+
135+
**Fixed**
136+
137+
- πŸ› [Fix-1]: [Short description of the fix] by @[author]
138+
- πŸ› [Fix-2]: [Short description of the fix] by @[author]
139+
140+
### **[Package-Name-2]:**
141+
142+
**Added**
143+
144+
- ✨ [Feature-1]: [Short description of the feature] by @[author]
145+
146+
> Note: [Include any important dependency or compatibility notes here.]
147+
148+
---
149+
150+
**Best,**
151+
The EDS Core Team
152+
153+
---
154+
155+
## GitHub Releases
156+
157+
GitHub releases are now created automatically when the release PR is merged. The releases will include:
158+
159+
- All commit types from the CHANGELOG (features, fixes, docs, etc.)
160+
- Proper version tags matching the npm packages
161+
- Release notes generated from conventional commits
162+
163+
If you need to edit a release after it's created:
164+
165+
1. Go to [GitHub Releases](https://github.com/equinor/design-system/releases)
166+
2. Find the release you want to edit
167+
3. Click "Edit release"
168+
4. Make necessary changes and save
169+
170+
## Troubleshooting
171+
172+
**No release PR created?**
173+
174+
- Check commit format follows conventional commits
175+
- Verify commits on `main` with package scope
176+
177+
**Wrong version bump?**
178+
179+
- `feat!:` = major
180+
- `feat:` = minor
181+
- `fix:` = patch
182+
183+
**Publishing failed?**
184+
185+
- Check workflow logs in GitHub Actions
186+
- Re-run workflow or publish manually
187+
188+
**Need to skip release?**
189+
190+
- Leave PR open, merge later
191+
192+
**Need to rollback a release?**
193+
194+
If a release has critical issues:
195+
196+
1. **Create hotfix immediately**: Make emergency fix and create new release (recommended approach)
197+
2. **Deprecate problematic version**: Use `npm deprecate @equinor/package@version "Critical issue - use version X.X.X instead"`
198+
3. **Communicate quickly**: Announce the issue and hotfix plan in #eds-design-system and affected channels
199+
4. **Document the incident**: Update release notes to mention the issue and resolution
200+
201+
**Release PR disappeared or corrupted?**
202+
203+
- Release Please recreates PRs automatically on next push to `main`
204+
- Don't try to manually recreate - let Release Please handle it
205+
206+
## Configuration
207+
208+
- [`.github/release-please-config.md`](../../.github/release-please-config.md) - Detailed config docs
209+
- [CONVENTIONAL_COMMITS.md](./CONVENTIONAL_COMMITS.md) - Commit guidelines
210+
211+
## Resources
212+
213+
- [Release Please Docs](https://github.com/googleapis/release-please)
214+
- [Semantic Versioning](https://semver.org/)

0 commit comments

Comments
Β (0)