Commit 2ff8c59
authored
ci: Refactor automated release and publishing workflows with Release Please (#1215)
JIRA: CPOUI5FOUNDATION-1166
## 🔧 Technical Challenges & Solutions
### 1. Circular Peer Dependencies
**Problem:** `@ui5/project` has `peerDependency` on `@ui5/builder`,
while `@ui5/builder` has `devDependency` on `@ui5/project`. The
`node-workspace` plugin detected this cycle:
```
Error: found cycle in dependency graph: @ui5/builder -> @ui5/project -> @ui5/builder
```
**Solution:**
- Configured `node-workspace` plugin with `updatePeerDependencies: true`
- Added automated workflow step that manually updates `@ui5/builder`
peer dependency in `packages/project/package.json`
- Uses `jq` for surgical JSON manipulation to update version range from
`^4.x` to `^5.x`
```yaml
BUILDER_VERSION=$(jq -r '.version' packages/builder/package.json)
jq --tab --arg new_version "^$BUILDER_VERSION" \
'.peerDependencies."@ui5/builder" = $new_version' \
packages/project/package.json > tmp.$$.json
```
### 2. Package-Lock Corruption from npm Aliases
**Problem:** The `node-workspace` plugin corrupted `package-lock.json`
by updating npm alias entries in `internal/documentation/package.json`.
This created inconsistent lockfile entries mixing workspace versions
with registry URLs:
```json
"node_modules/@ui5/fs-npm": {
"name": "@ui5/fs",
"version": "5.0.0-alpha.0", // ❌ New workspace version
"resolved": "https://registry.npmjs.org/@ui5/fs/-/fs-4.0.3.tgz", // ❌ Old registry URL
"integrity": "sha512-..."
}
```
**Solution:**
Implemented automated lockfile restoration that:
1. Runs `npm install` to regenerate workspace lockfile entries
2. Selectively restores npm alias entries from `origin/main` using `jq`
3. Preserves workspace updates while keeping npm aliases at stable
registry versions
```bash
# Restore npm alias entries from main branch
git show origin/main:package-lock.json | \
jq -r '.packages | to_entries[] |
select(.key | test("node_modules/@ui5/(builder|cli|fs|logger|project|server)-npm$")) |
.key' | while read key; do
original_entry=$(git show origin/main:package-lock.json | jq ".packages[\"$key\"]")
jq --tab --arg key "$key" --argjson entry "$original_entry" \
'.packages[$key] = $entry' package-lock.json > tmp.$$.json
mv tmp.$$.json package-lock.json
done
```
### 3. PR Title Version Extraction
**Problem:** Release Please's `${version}` template doesn't work with
grouped monorepo releases using the `linked-versions` plugin (no root
package context).
**Solution:**
- Used `${branch}` in PR title pattern: `"release: UI5 CLI packages
${branch}"`
- Final title: `"release: UI5 CLI packages main"`1 parent 9478c4b commit 2ff8c59
File tree
2 files changed
+48
-8
lines changed- .github/workflows
2 files changed
+48
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
30 | 70 | | |
31 | 71 | | |
32 | 72 | | |
| |||
79 | 119 | | |
80 | 120 | | |
81 | 121 | | |
82 | | - | |
| 122 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments