Skip to content

Commit 84cab00

Browse files
committed
Update publish workflow to check beta vs stable releases
1 parent f09580b commit 84cab00

3 files changed

Lines changed: 111 additions & 53 deletions

File tree

.github/workflows/trigger_publish.yml

Lines changed: 98 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,67 @@ jobs:
3333
runs-on: ubuntu-latest
3434
outputs:
3535
should-publish: ${{ steps.validate.outputs.should-publish }}
36-
is-beta-release: ${{ steps.validate.outputs.is-beta-release }}
3736
steps:
3837
- name: Validate PR status
3938
id: validate
4039
run: |
4140
# Check if PR was merged (not just closed)
4241
if [ "${{ github.event.pull_request.merged }}" != "true" ]; then
4342
echo "should-publish=false" >> $GITHUB_OUTPUT
44-
echo "is-beta-release=false" >> $GITHUB_OUTPUT
4543
exit 0
4644
fi
4745
4846
# Check if this is a release PR (title contains "chore: release")
4947
if [[ "${{ github.event.pull_request.title }}" != *"chore: release"* ]]; then
5048
echo "should-publish=false" >> $GITHUB_OUTPUT
51-
echo "is-beta-release=false" >> $GITHUB_OUTPUT
5249
exit 0
5350
fi
5451
55-
# Check if this is a beta release (contains "next" in title)
56-
if [[ "${{ github.event.pull_request.title }}" == *"next"* ]]; then
57-
echo "is-beta-release=true" >> $GITHUB_OUTPUT
52+
# All validation checks passed
53+
echo "should-publish=true" >> $GITHUB_OUTPUT
54+
55+
# Job 1: Detect which release channels (stable/beta) were affected
56+
# Looks for changelog edits in the merge commit
57+
detect-release:
58+
needs: validate-release
59+
if: needs.validate-release.outputs.should-publish == 'true'
60+
runs-on: ubuntu-latest
61+
outputs:
62+
has-stable-release: ${{ steps.detect.outputs.has-stable-release }}
63+
has-beta-release: ${{ steps.detect.outputs.has-beta-release }}
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 2
69+
70+
- name: Detect release type
71+
id: detect
72+
run: |
73+
CHANGED_FILES=$(git diff HEAD^ HEAD --name-only)
74+
75+
echo "Changed files:" >> $GITHUB_STEP_SUMMARY
76+
echo '```' >> $GITHUB_STEP_SUMMARY
77+
echo "$CHANGED_FILES" >> $GITHUB_STEP_SUMMARY
78+
echo '```' >> $GITHUB_STEP_SUMMARY
79+
80+
if echo "$CHANGED_FILES" | grep -q '^packages/eds-core-react/CHANGELOG\.md$'; then
81+
echo "has-stable-release=true" >> $GITHUB_OUTPUT
82+
echo "- ✅ Stable changelog updated" >> $GITHUB_STEP_SUMMARY
5883
else
59-
echo "is-beta-release=false" >> $GITHUB_OUTPUT
84+
echo "has-stable-release=false" >> $GITHUB_OUTPUT
85+
echo "- ⏭️ Stable changelog unchanged" >> $GITHUB_STEP_SUMMARY
6086
fi
6187
62-
# All validation checks passed
63-
echo "should-publish=true" >> $GITHUB_OUTPUT
88+
if echo "$CHANGED_FILES" | grep -q '^packages/eds-core-react/CHANGELOG\.next\.md$'; then
89+
echo "has-beta-release=true" >> $GITHUB_OUTPUT
90+
echo "- ✅ Beta changelog updated" >> $GITHUB_STEP_SUMMARY
91+
else
92+
echo "has-beta-release=false" >> $GITHUB_OUTPUT
93+
echo "- ⏭️ Beta changelog unchanged" >> $GITHUB_STEP_SUMMARY
94+
fi
6495
65-
# Job 1: Determine which packages need to be published
96+
# Job 2: Determine which packages need publishing
6697
# Checks the release-please-manifest.json to see which packages had version changes
6798
check-releases:
6899
needs: validate-release
@@ -162,42 +193,54 @@ jobs:
162193
echo "" >> $GITHUB_STEP_SUMMARY
163194
echo "📝 **Note:** eds-utils is published as part of eds-core-react" >> $GITHUB_STEP_SUMMARY
164195
165-
# Job 2: Trigger core-react publish workflow
166-
# Only runs if core-react package.json was changed
167-
trigger-core-react:
168-
needs: [validate-release, check-releases]
169-
if: needs.check-releases.outputs.core-react == 'true'
196+
# Job 3: Trigger core-react stable publish workflow
197+
trigger-core-react-stable:
198+
needs: [validate-release, detect-release, check-releases]
199+
if: needs.validate-release.outputs.should-publish == 'true' && needs.detect-release.outputs.has-stable-release == 'true' && needs.check-releases.outputs.core-react == 'true'
170200
runs-on: ubuntu-latest
171201
steps:
172-
- name: Trigger core-react publish
202+
- name: Trigger core-react stable publish
173203
id: trigger
174204
env:
175-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for gh CLI authentication
205+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176206
run: |
177-
# Determine npm tag based on release type
178-
if [ "${{ needs.validate-release.outputs.is-beta-release }}" == "true" ]; then
179-
NPM_TAG="beta"
180-
else
181-
NPM_TAG="latest"
182-
fi
207+
gh workflow run publish_core_react.yaml \
208+
--repo ${{ github.repository }} \
209+
--ref main \
210+
-f npm-tag=latest
211+
continue-on-error: true
212+
213+
- name: Report failure
214+
if: steps.trigger.outcome == 'failure'
215+
run: |
216+
echo "::error title=Core React Stable Publish Failed::Failed to trigger stable publish workflow for @equinor/eds-core-react"
217+
echo "❌ Failed to trigger stable publish workflow" >> $GITHUB_STEP_SUMMARY
183218
184-
# Use GitHub CLI to trigger the publish workflow
185-
# Note: Beta releases skip Storybook deployment (controlled in publish_core_react.yaml)
219+
# Job 4: Trigger core-react beta publish workflow
220+
trigger-core-react-beta:
221+
needs: [validate-release, detect-release, check-releases]
222+
if: needs.validate-release.outputs.should-publish == 'true' && needs.detect-release.outputs.has-beta-release == 'true' && needs.check-releases.outputs.core-react == 'true'
223+
runs-on: ubuntu-latest
224+
steps:
225+
- name: Trigger core-react beta publish
226+
id: trigger
227+
env:
228+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
229+
run: |
186230
gh workflow run publish_core_react.yaml \
187231
--repo ${{ github.repository }} \
188232
--ref main \
189-
-f npm-tag=$NPM_TAG
190-
# Allow other packages to continue even if this one fails
233+
-f npm-tag=beta
191234
continue-on-error: true
192235

193236
- name: Report failure
194237
if: steps.trigger.outcome == 'failure'
195238
run: |
196-
echo "::error title=Core React Publish Failed::Failed to trigger publish workflow for @equinor/eds-core-react"
197-
echo "❌ Failed to trigger core-react publish workflow" >> $GITHUB_STEP_SUMMARY
239+
echo "::error title=Core React Beta Publish Failed::Failed to trigger beta publish workflow for @equinor/eds-core-react"
240+
echo "❌ Failed to trigger beta publish workflow" >> $GITHUB_STEP_SUMMARY
198241
199-
# Job 3: Trigger lab-react publish workflow
200-
# Only runs if lab-react package.json was changed
242+
# Job 5: Trigger lab-react publish workflow
243+
# Only runs if the Release Please manifest bumped lab-react
201244
trigger-lab-react:
202245
needs: check-releases
203246
if: needs.check-releases.outputs.lab-react == 'true'
@@ -221,8 +264,8 @@ jobs:
221264
echo "::error title=Lab React Publish Failed::Failed to trigger publish workflow for @equinor/eds-lab-react"
222265
echo "❌ Failed to trigger lab-react publish workflow" >> $GITHUB_STEP_SUMMARY
223266
224-
# Job 4: Trigger data-grid-react publish workflow
225-
# Only runs if data-grid-react package.json was changed
267+
# Job 6: Trigger data-grid-react publish workflow
268+
# Only runs if the Release Please manifest bumped data-grid-react
226269
trigger-data-grid-react:
227270
needs: check-releases
228271
if: needs.check-releases.outputs.data-grid-react == 'true'
@@ -246,8 +289,8 @@ jobs:
246289
echo "::error title=Data Grid React Publish Failed::Failed to trigger publish workflow for @equinor/eds-data-grid-react"
247290
echo "❌ Failed to trigger data-grid-react publish workflow" >> $GITHUB_STEP_SUMMARY
248291
249-
# Job 5: Trigger icons publish workflow
250-
# Only runs if icons package.json was changed
292+
# Job 7: Trigger icons publish workflow
293+
# Only runs if the Release Please manifest bumped icons
251294
trigger-icons:
252295
needs: check-releases
253296
if: needs.check-releases.outputs.icons == 'true'
@@ -270,8 +313,8 @@ jobs:
270313
echo "::error title=Icons Publish Failed::Failed to trigger publish workflow for @equinor/eds-icons"
271314
echo "❌ Failed to trigger icons publish workflow" >> $GITHUB_STEP_SUMMARY
272315
273-
# Job 6: Trigger tokens publish workflow
274-
# Only runs if tokens package.json was changed
316+
# Job 8: Trigger tokens publish workflow
317+
# Only runs if the Release Please manifest bumped tokens
275318
trigger-tokens:
276319
needs: check-releases
277320
if: needs.check-releases.outputs.tokens == 'true'
@@ -294,12 +337,13 @@ jobs:
294337
echo "::error title=Tokens Publish Failed::Failed to trigger publish workflow for @equinor/eds-tokens"
295338
echo "❌ Failed to trigger tokens publish workflow" >> $GITHUB_STEP_SUMMARY
296339
297-
# Job 7: Summary report of all publish triggers
340+
# Job 9: Summary report of all publish triggers
298341
# Runs independently after check-releases completes
299342
# Provides a clear overview of which packages were triggered for publishing
300343
publish-summary:
301344
needs:
302345
- validate-release
346+
- detect-release
303347
- check-releases
304348
# Always run this job, even if some trigger jobs failed or were skipped
305349
if: always()
@@ -329,6 +373,22 @@ jobs:
329373
echo "## 📦 Package Publish Trigger Summary" >> $GITHUB_STEP_SUMMARY
330374
echo "" >> $GITHUB_STEP_SUMMARY
331375
echo "This workflow triggered publish workflows for packages that had version changes." >> $GITHUB_STEP_SUMMARY
376+
echo "" >> $GITHUB_STEP_SUMMARY
377+
echo "### Release types detected" >> $GITHUB_STEP_SUMMARY
378+
echo "" >> $GITHUB_STEP_SUMMARY
379+
380+
if [ "${{ needs.detect-release.outputs.has-stable-release }}" == "true" ]; then
381+
echo "- ✅ Stable changelog updated" >> $GITHUB_STEP_SUMMARY
382+
else
383+
echo "- ⏭️ Stable changelog unchanged" >> $GITHUB_STEP_SUMMARY
384+
fi
385+
386+
if [ "${{ needs.detect-release.outputs.has-beta-release }}" == "true" ]; then
387+
echo "- ✅ Beta changelog updated" >> $GITHUB_STEP_SUMMARY
388+
else
389+
echo "- ⏭️ Beta changelog unchanged" >> $GITHUB_STEP_SUMMARY
390+
fi
391+
332392
echo "" >> $GITHUB_STEP_SUMMARY
333393
echo "### Results:" >> $GITHUB_STEP_SUMMARY
334394
echo "" >> $GITHUB_STEP_SUMMARY

documentation/how-to/BETA_RELEASE_GUIDE.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ This guide explains how beta releases work for EDS 2.0 components under the `/ne
44

55
## Quick Reference
66

7-
| Action | Command |
8-
|--------|---------|
9-
| Install beta | `npm install @equinor/eds-core-react@beta` |
10-
| Import beta component | `import { Button } from '@equinor/eds-core-react/next'` |
11-
| Commit for beta | `feat(next): add new component` |
12-
| View beta versions | `npm view @equinor/eds-core-react versions \| grep beta` |
7+
| Action | Command |
8+
| --------------------- | -------------------------------------------------------- |
9+
| Install beta | `npm install @equinor/eds-core-react@beta` |
10+
| Import beta component | `import { Button } from '@equinor/eds-core-react/next'` |
11+
| Commit for beta | `feat(next): add new component` |
12+
| View beta versions | `npm view @equinor/eds-core-react versions \| grep beta` |
1313

1414
## Overview
1515

@@ -85,15 +85,15 @@ Beta components are **visible in production Storybook** under the **"EDS 2.0"**
8585

8686
### Storybook Labeling Tips
8787

88-
Add a visual indicator in story titles so teams immediately know the component is in beta. If you use `storybook-addon-badges`, you can also surface badges in the docs tab:
88+
Add a visual indicator in story titles so teams immediately know the component is in beta:
8989

9090
```typescript
9191
// In component stories
9292
export default {
93-
title: 'EDS 2.0 (beta)/Inputs/Button',
94-
parameters: {
95-
badges: ['beta', 'next'],
96-
},
93+
title: 'EDS 2.0 (beta)/Inputs/Button',
94+
parameters: {
95+
badges: ['beta', 'next'],
96+
},
9797
}
9898
```
9999

@@ -208,8 +208,6 @@ EDS 2.0 components will graduate as a **complete set** in a single major release
208208
- Button: API changes, see migration guide
209209
- Typography: New props structure, see migration guide
210210
...
211-
212-
Migration guide: https://eds.equinor.com/migration/v3"
213211
```
214212
215213
#### Benefits of Batch Graduation

packages/eds-core-react/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import { Button, Typography } from '@equinor/eds-core-react/next'
3030
```
3131

3232
**Learn more:**
33-
- [Beta Release Guide](../../documentation/how-to/BETA_RELEASE.md)
34-
- [View beta components in Storybook](https://storybook.eds.equinor.com)
33+
- [Complete Beta Release Guide](../../documentation/how-to/BETA_RELEASE_GUIDE.md)
34+
- [Preview EDS 2.0 components in Storybook](https://storybook.eds.equinor.com)
3535

3636
### Additional Setup
3737

0 commit comments

Comments
 (0)