Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/release-please-config.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very nice. I just added some questions to better understand the configuration. Also tested to mention copilot to see if it can answer inline, but please answer them if you have the answer @pomfrida :D

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know the effect of using different component value?

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"packages/eds-core-react": {
"release-type": "node",
"package-name": "@equinor/eds-core-react",
"component": "eds-core-react"
"component": "eds-core-react",
"exclude-paths": ["src/components/next"]
},
"packages/eds-core-react/src/components/next": {
"release-type": "simple",
"component": "eds-core-react-next",
"prerelease-type": "beta",
"include-component-in-tag": false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the effect of this configuration @copilot ?

},
"packages/eds-data-grid-react": {
"release-type": "node",
Expand Down
105 changes: 96 additions & 9 deletions .github/release-please-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,55 @@ Each package in the monorepo must be explicitly configured:

We currently track these packages for releases:

1. `@equinor/eds-core-react` - Core React component library
2. `@equinor/eds-data-grid-react` - Data grid component
3. `@equinor/eds-icons` - Icon library
4. `@equinor/eds-lab-react` - Experimental components
5. `@equinor/eds-tokens` - Design tokens and variables
6. `@equinor/eds-utils` - Shared utilities
1. `@equinor/eds-core-react` - Core React component library (stable)
2. `@equinor/eds-core-react` (`/next` entry) - Beta components (published with `@beta` tag)
3. `@equinor/eds-data-grid-react` - Data grid component
4. `@equinor/eds-icons` - Icon library
5. `@equinor/eds-lab-react` - Experimental components
6. `@equinor/eds-tokens` - Design tokens and variables
7. `@equinor/eds-utils` - Shared utilities

### Dual Release Strategy for `@equinor/eds-core-react`

The `eds-core-react` package uses a **dual release strategy** to support both stable and beta releases:

**Stable Release** (`latest` tag):

```json
"packages/eds-core-react": {
"release-type": "node",
"package-name": "@equinor/eds-core-react",
"component": "eds-core-react",
"exclude-paths": ["src/components/next"]
}
```

- Excludes `/next` folder from stable releases
- Published to `@equinor/eds-core-react@latest`
- Uses `CHANGELOG.md`

**Beta Release** (`beta` tag):

```json
"packages/eds-core-react/src/components/next": {
"release-type": "simple",
"component": "eds-core-react-next",
"prerelease-type": "beta",
"include-component-in-tag": false
}
```

- Only includes files in `src/components/next/`
- Published to `@equinor/eds-core-react@beta`
- Uses `src/components/next/CHANGELOG.md`
- Version format: `2.0.1-beta.0`, `2.0.1-beta.1`, etc.

**Key Configuration Options:**

- `exclude-paths`: Prevents `/next` components from affecting stable releases
- `prerelease-type: "beta"`: Adds `-beta.X` suffix to versions
- `changelog-path`: Uses separate changelog for beta releases
- `include-component-in-tag: false`: Prevents duplicate tags

## Pull Request Configuration

Expand Down Expand Up @@ -186,6 +229,8 @@ The releases include all commit types from the changelog (features, fixes, docs,

## Multi-Package Example

### Stable + Multiple Packages

If you make these commits:

```bash
Expand All @@ -203,27 +248,69 @@ Release-please will create ONE PR that:

When merged, three separate GitHub releases will be created automatically.

### Beta Release Example

If you make these commits:

```bash
feat(next): add Input component
fix(next): fix Placeholder styling
```

Release-please will include beta changes in the release PR:

- Title includes "next": `chore: release eds-core-react-next 2.0.1-beta.1`
- Bumps beta version: `2.0.1-beta.0` → `2.0.1-beta.1`
- Updates `src/components/next/CHANGELOG.md`
- When merged, publishes to `@equinor/eds-core-react@beta`

**Note:** With `"separate-pull-requests": false`, both stable and beta changes can appear in the **same PR** if you have commits for both. The PR will contain updates to both `CHANGELOG.md` and `src/components/next/CHANGELOG.md`.

## Commit Scope Matching

The `component` field must match commit scopes for release-please to detect which packages are affected:

```bash
# These commits affect the corresponding packages:
feat(eds-core-react): ... → packages/eds-core-react
# Stable releases:
feat(eds-core-react): ... → packages/eds-core-react (stable)
fix(Button): ... → packages/eds-core-react (stable)
fix(eds-icons): ... → packages/eds-icons
docs(eds-tokens): ... → packages/eds-tokens

# Beta releases (use "next" scope):
feat(next): ... → packages/eds-core-react@beta
fix(next): ... → packages/eds-core-react@beta

# Multiple packages in one commit:
feat(eds-icons, eds-core-react): ... → both packages
```

### Beta Release Commits

For components in the `/next` entry point, always use the `(next)` scope:

```bash
# Features
feat(next): add Input 2.0 component

# Bug fixes
fix(next): correct Input 2.0 styling

# Breaking changes - DO NOT use ! for beta
feat(next): redesign Input 2.0 API (breaking)
# NOT: feat(next)!: redesign Button API
```

**Important:** Avoid using `!` (breaking change marker) for beta releases. Beta components are experimental and breaking changes are expected. Using `!` would trigger a major version bump (e.g., `2.0.1-beta.0` → `3.0.0-beta.0`), which is unnecessary for components under development.

## Related Files

- **Config**: `.github/release-please-config.json` (this documentation)
- **Manifest**: `.github/release-please-manifest.json` (tracks current versions)
- **Workflow**: `.github/workflows/release-please.yml` (triggers release-please)
- **Publish**: `.github/workflows/trigger-publish.yml` (publishes after release)
- **Publish**: `.github/workflows/trigger-publish.yml` (publishes after release, handles beta detection)
- **Automated release documentation**: `../documentation/how-to/AUTOMATED_RELEASE.md`
- **Beta release guide**: `documentation/how-to/BETA_RELEASE_GUIDE.md` (detailed beta workflow)

## Useful Links

Expand Down
1 change: 1 addition & 0 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"packages/eds-core-react": "2.1.0",
"packages/eds-core-react/src/components/next": "2.1.0-beta.0",
"packages/eds-data-grid-react": "1.1.0",
"packages/eds-icons": "1.0.1",
"packages/eds-lab-react": "0.9.0",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish_core_react.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ jobs:
steps: ${{ toJson(steps) }}
if: failure()
purge-cdn:
if: github.event.inputs.environment == 'production'
# Only purge CDN for production releases (latest tag)
if: github.event.inputs.npm-tag == 'latest'
needs: [publish-storybook]
name: Purge cdn
uses: ./.github/workflows/_purge_cdn.yaml
Expand Down
121 changes: 100 additions & 21 deletions .github/workflows/trigger_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,48 @@ jobs:
# All validation checks passed
echo "should-publish=true" >> $GITHUB_OUTPUT

# Job 1: Determine which packages need to be published
# Job 1: Detect which release channels (stable/beta) were affected
# Looks for changelog edits in the merge commit
detect-release:
needs: validate-release
if: needs.validate-release.outputs.should-publish == 'true'
runs-on: ubuntu-latest
outputs:
has-stable-release: ${{ steps.detect.outputs.has-stable-release }}
has-beta-release: ${{ steps.detect.outputs.has-beta-release }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Detect release type
id: detect
run: |
CHANGED_FILES=$(git diff HEAD^ HEAD --name-only)

echo "Changed files:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "$CHANGED_FILES" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

if echo "$CHANGED_FILES" | grep -q '^packages/eds-core-react/CHANGELOG\.md$'; then
echo "has-stable-release=true" >> $GITHUB_OUTPUT
echo "- ✅ Stable changelog updated" >> $GITHUB_STEP_SUMMARY
else
echo "has-stable-release=false" >> $GITHUB_OUTPUT
echo "- ⏭️ Stable changelog unchanged" >> $GITHUB_STEP_SUMMARY
fi

if echo "$CHANGED_FILES" | grep -q '^packages/eds-core-react/src/components/next/CHANGELOG\.md$'; then
echo "has-beta-release=true" >> $GITHUB_OUTPUT
echo "- ✅ Beta changelog updated" >> $GITHUB_STEP_SUMMARY
else
echo "has-beta-release=false" >> $GITHUB_OUTPUT
echo "- ⏭️ Beta changelog unchanged" >> $GITHUB_STEP_SUMMARY
fi

# Job 2: Determine which packages need publishing
# Checks the release-please-manifest.json to see which packages had version changes
check-releases:
needs: validate-release
Expand Down Expand Up @@ -152,35 +193,56 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY
echo "📝 **Note:** eds-utils is published as part of eds-core-react" >> $GITHUB_STEP_SUMMARY

# Job 2: Trigger core-react publish workflow
# Only runs if core-react package.json was changed
trigger-core-react:
needs: check-releases
if: needs.check-releases.outputs.core-react == 'true'
# Job 3: Trigger core-react stable publish workflow
trigger-core-react-stable:
needs: [validate-release, detect-release, check-releases]
if: needs.validate-release.outputs.should-publish == 'true' && needs.detect-release.outputs.has-stable-release == 'true' && needs.check-releases.outputs.core-react == 'true'
runs-on: ubuntu-latest
steps:
- name: Trigger core-react publish
- name: Trigger core-react stable publish
id: trigger
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for gh CLI authentication
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Use GitHub CLI to trigger the publish workflow
gh workflow run publish_core_react.yaml \
--repo ${{ github.repository }} \
--ref main \
-f npm-tag=latest \
-f environment=production
# Allow other packages to continue even if this one fails
continue-on-error: true

- name: Report failure
if: steps.trigger.outcome == 'failure'
run: |
echo "::error title=Core React Publish Failed::Failed to trigger publish workflow for @equinor/eds-core-react"
echo "❌ Failed to trigger core-react publish workflow" >> $GITHUB_STEP_SUMMARY
echo "::error title=Core React Stable Publish Failed::Failed to trigger stable publish workflow for @equinor/eds-core-react"
echo "❌ Failed to trigger stable publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 3: Trigger lab-react publish workflow
# Only runs if lab-react package.json was changed
# Job 4: Trigger core-react beta publish workflow
trigger-core-react-beta:
needs: [validate-release, detect-release, check-releases]
if: needs.validate-release.outputs.should-publish == 'true' && needs.detect-release.outputs.has-beta-release == 'true' && needs.check-releases.outputs.core-react == 'true'
runs-on: ubuntu-latest
steps:
- name: Trigger core-react beta publish
id: trigger
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run publish_core_react.yaml \
--repo ${{ github.repository }} \
--ref main \
-f npm-tag=beta \
-f environment=production
continue-on-error: true

- name: Report failure
if: steps.trigger.outcome == 'failure'
run: |
echo "::error title=Core React Beta Publish Failed::Failed to trigger beta publish workflow for @equinor/eds-core-react"
echo "❌ Failed to trigger beta publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 5: Trigger lab-react publish workflow
# Only runs if the Release Please manifest bumped lab-react
trigger-lab-react:
needs: check-releases
if: needs.check-releases.outputs.lab-react == 'true'
Expand All @@ -204,8 +266,8 @@ jobs:
echo "::error title=Lab React Publish Failed::Failed to trigger publish workflow for @equinor/eds-lab-react"
echo "❌ Failed to trigger lab-react publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 4: Trigger data-grid-react publish workflow
# Only runs if data-grid-react package.json was changed
# Job 6: Trigger data-grid-react publish workflow
# Only runs if the Release Please manifest bumped data-grid-react
trigger-data-grid-react:
needs: check-releases
if: needs.check-releases.outputs.data-grid-react == 'true'
Expand All @@ -229,8 +291,8 @@ jobs:
echo "::error title=Data Grid React Publish Failed::Failed to trigger publish workflow for @equinor/eds-data-grid-react"
echo "❌ Failed to trigger data-grid-react publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 5: Trigger icons publish workflow
# Only runs if icons package.json was changed
# Job 7: Trigger icons publish workflow
# Only runs if the Release Please manifest bumped icons
trigger-icons:
needs: check-releases
if: needs.check-releases.outputs.icons == 'true'
Expand All @@ -253,8 +315,8 @@ jobs:
echo "::error title=Icons Publish Failed::Failed to trigger publish workflow for @equinor/eds-icons"
echo "❌ Failed to trigger icons publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 6: Trigger tokens publish workflow
# Only runs if tokens package.json was changed
# Job 8: Trigger tokens publish workflow
# Only runs if the Release Please manifest bumped tokens
trigger-tokens:
needs: check-releases
if: needs.check-releases.outputs.tokens == 'true'
Expand All @@ -277,12 +339,13 @@ jobs:
echo "::error title=Tokens Publish Failed::Failed to trigger publish workflow for @equinor/eds-tokens"
echo "❌ Failed to trigger tokens publish workflow" >> $GITHUB_STEP_SUMMARY

# Job 7: Summary report of all publish triggers
# Job 9: Summary report of all publish triggers
# Runs independently after check-releases completes
# Provides a clear overview of which packages were triggered for publishing
publish-summary:
needs:
- validate-release
- detect-release
- check-releases
# Always run this job, even if some trigger jobs failed or were skipped
if: always()
Expand Down Expand Up @@ -312,6 +375,22 @@ jobs:
echo "## 📦 Package Publish Trigger Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "This workflow triggered publish workflows for packages that had version changes." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Release types detected" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "${{ needs.detect-release.outputs.has-stable-release }}" == "true" ]; then
echo "- ✅ Stable changelog updated" >> $GITHUB_STEP_SUMMARY
else
echo "- ⏭️ Stable changelog unchanged" >> $GITHUB_STEP_SUMMARY
fi

if [ "${{ needs.detect-release.outputs.has-beta-release }}" == "true" ]; then
echo "- ✅ Beta changelog updated" >> $GITHUB_STEP_SUMMARY
else
echo "- ⏭️ Beta changelog unchanged" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "### Results:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
Expand Down
Loading
Loading