1717 types : [closed] # Only runs when PR is closed (includes both merged and manually closed)
1818 branches :
1919 # - develop # TODO: enable after testing
20- - fre/release-please
20+ - fre/release-please # Test branch - TODO: Remove after testing
2121
2222# Required permissions
2323permissions :
24- contents : write # Needed to read repository content and check file changes
24+ contents : read # Needed to read repository content and check file changes
2525 actions : write # Needed to trigger other workflows via gh CLI
2626
2727jobs :
@@ -30,12 +30,10 @@ jobs:
3030 check-releases :
3131 # Only run if:
3232 # 1. PR was actually merged (not just closed)
33- # 2. PR title contains "chore: release" (indicates it's a release-please PR
34- # 3. PR only on develop branch
33+ # 2. PR title contains "chore: release" (indicates it's a release-please PR)
3534 if : |
3635 github.event.pull_request.merged == true &&
37- contains(github.event.pull_request.title, 'chore: release') &&
38- github.event.pull_request.base.ref == 'develop'
36+ contains(github.event.pull_request.title, 'chore: release')
3937 runs-on : ubuntu-latest
4038 # Expose outputs so downstream jobs can check which packages changed
4139 outputs :
@@ -46,63 +44,91 @@ jobs:
4644 tokens : ${{ steps.check.outputs.tokens }}
4745
4846 steps :
49- # Checkout the repository with enough history to compare commits
47+ # Checkout the repository with full PR history
5048 - name : Checkout
5149 uses : actions/checkout@v4
5250 with :
53- fetch-depth : 2 # Fetch last 2 commits so we can diff HEAD~1 and HEAD
51+ fetch-depth : 0 # Fetch full history to ensure we can diff properly
5452
5553 # Check which package.json files were modified in the merge
5654 # For each package, sets output to 'true' if its package.json changed, 'false' otherwise
5755 - name : Check which packages changed
5856 id : check
5957 run : |
60- # Compare HEAD~1 (before merge) with HEAD (after merge)
61- # grep -q returns 0 (success) if pattern is found, 1 if not found
58+ # Use PR base and head SHAs for accurate diff
59+ # This works correctly regardless of merge strategy (squash/merge/rebase)
60+ # - base.sha: commit where PR branched from develop
61+ # - head.sha: latest commit in PR branch before merge
62+ # This ensures we capture ALL changes in the PR, not just the merge commit
63+ BASE_SHA="${{ github.event.pull_request.base.sha }}"
64+ HEAD_SHA="${{ github.event.pull_request.head.sha }}"
65+
66+ echo "Comparing $BASE_SHA...$HEAD_SHA"
67+
68+ # Get list of changed files
69+ CHANGED_FILES=$(git diff --name-only $BASE_SHA $HEAD_SHA)
70+ echo "Changed files:"
71+ echo "$CHANGED_FILES"
6272
6373 # Check eds-core-react
64- if git diff HEAD~1 HEAD --name-only | grep -q "packages/eds-core-react/package.json"; then
74+ if echo "$CHANGED_FILES" | grep -q "packages/eds-core-react/package.json"; then
6575 echo "core-react=true" >> $GITHUB_OUTPUT
76+ echo "✅ eds-core-react changed"
6677 else
6778 echo "core-react=false" >> $GITHUB_OUTPUT
79+ echo "⏭️ eds-core-react unchanged"
6880 fi
6981
7082 # Check eds-lab-react
71- if git diff HEAD~1 HEAD --name-only | grep -q "packages/eds-lab-react/package.json"; then
83+ if echo "$CHANGED_FILES" | grep -q "packages/eds-lab-react/package.json"; then
7284 echo "lab-react=true" >> $GITHUB_OUTPUT
85+ echo "✅ eds-lab-react changed"
7386 else
7487 echo "lab-react=false" >> $GITHUB_OUTPUT
88+ echo "⏭️ eds-lab-react unchanged"
7589 fi
7690
7791 # Check eds-data-grid-react
78- if git diff HEAD~1 HEAD --name-only | grep -q "packages/eds-data-grid-react/package.json"; then
92+ if echo "$CHANGED_FILES" | grep -q "packages/eds-data-grid-react/package.json"; then
7993 echo "data-grid-react=true" >> $GITHUB_OUTPUT
94+ echo "✅ eds-data-grid-react changed"
8095 else
8196 echo "data-grid-react=false" >> $GITHUB_OUTPUT
97+ echo "⏭️ eds-data-grid-react unchanged"
8298 fi
8399
84100 # Check eds-icons
85- if git diff HEAD~1 HEAD --name-only | grep -q "packages/eds-icons/package.json"; then
101+ if echo "$CHANGED_FILES" | grep -q "packages/eds-icons/package.json"; then
86102 echo "icons=true" >> $GITHUB_OUTPUT
103+ echo "✅ eds-icons changed"
87104 else
88105 echo "icons=false" >> $GITHUB_OUTPUT
106+ echo "⏭️ eds-icons unchanged"
89107 fi
90108
91109 # Check eds-tokens
92- if git diff HEAD~1 HEAD --name-only | grep -q "packages/eds-tokens/package.json"; then
110+ if echo "$CHANGED_FILES" | grep -q "packages/eds-tokens/package.json"; then
93111 echo "tokens=true" >> $GITHUB_OUTPUT
112+ echo "✅ eds-tokens changed"
94113 else
95114 echo "tokens=false" >> $GITHUB_OUTPUT
115+ echo "⏭️ eds-tokens unchanged"
96116 fi
97117
118+ # Note: eds-utils is not checked because it's published as part of eds-core-react
119+
98120 # Job 2: Trigger core-react publish workflow
99121 # Only runs if core-react package.json was changed
100122 trigger-core-react :
101123 needs : check-releases
102124 if : needs.check-releases.outputs.core-react == 'true'
103125 runs-on : ubuntu-latest
126+ # Expose failure status so summary job can check it
127+ outputs :
128+ failed : ${{ steps.trigger.outcome == 'failure' }}
104129 steps :
105130 - name : Trigger core-react publish
131+ id : trigger
106132 env :
107133 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }} # GitHub token for gh CLI authentication
108134 run : |
@@ -112,15 +138,26 @@ jobs:
112138 --ref develop \
113139 -f npm-tag=latest \
114140 -f environment=production
141+ # Allow other packages to continue even if this one fails
142+ continue-on-error : true
143+
144+ - name : Report failure
145+ if : steps.trigger.outcome == 'failure'
146+ run : |
147+ echo "::error title=Core React Publish Failed::Failed to trigger publish workflow for @equinor/eds-core-react"
148+ echo "❌ Failed to trigger core-react publish workflow" >> $GITHUB_STEP_SUMMARY
115149
116150 # Job 3: Trigger lab-react publish workflow
117151 # Only runs if lab-react package.json was changed
118152 trigger-lab-react :
119153 needs : check-releases
120154 if : needs.check-releases.outputs.lab-react == 'true'
121155 runs-on : ubuntu-latest
156+ outputs :
157+ failed : ${{ steps.trigger.outcome == 'failure' }}
122158 steps :
123159 - name : Trigger lab-react publish
160+ id : trigger
124161 env :
125162 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
126163 run : |
@@ -129,15 +166,25 @@ jobs:
129166 --ref develop \
130167 -f npm-tag=latest \
131168 -f environment=production
169+ continue-on-error : true
170+
171+ - name : Report failure
172+ if : steps.trigger.outcome == 'failure'
173+ run : |
174+ echo "::error title=Lab React Publish Failed::Failed to trigger publish workflow for @equinor/eds-lab-react"
175+ echo "❌ Failed to trigger lab-react publish workflow" >> $GITHUB_STEP_SUMMARY
132176
133177 # Job 4: Trigger data-grid-react publish workflow
134178 # Only runs if data-grid-react package.json was changed
135179 trigger-data-grid-react :
136180 needs : check-releases
137181 if : needs.check-releases.outputs.data-grid-react == 'true'
138182 runs-on : ubuntu-latest
183+ outputs :
184+ failed : ${{ steps.trigger.outcome == 'failure' }}
139185 steps :
140186 - name : Trigger data-grid-react publish
187+ id : trigger
141188 env :
142189 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143190 run : |
@@ -146,35 +193,184 @@ jobs:
146193 --ref develop \
147194 -f npm-tag=latest \
148195 -f environment=production
196+ continue-on-error : true
197+
198+ - name : Report failure
199+ if : steps.trigger.outcome == 'failure'
200+ run : |
201+ echo "::error title=Data Grid React Publish Failed::Failed to trigger publish workflow for @equinor/eds-data-grid-react"
202+ echo "❌ Failed to trigger data-grid-react publish workflow" >> $GITHUB_STEP_SUMMARY
149203
150204 # Job 5: Trigger icons publish workflow
151205 # Only runs if icons package.json was changed
152206 trigger-icons :
153207 needs : check-releases
154208 if : needs.check-releases.outputs.icons == 'true'
155209 runs-on : ubuntu-latest
210+ outputs :
211+ failed : ${{ steps.trigger.outcome == 'failure' }}
156212 steps :
157213 - name : Trigger icons publish
214+ id : trigger
158215 env :
159216 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
160217 run : |
161218 gh workflow run publish_icons.yaml \
162219 --repo ${{ github.repository }} \
163220 --ref develop \
164- -f npm-tag=latest # Icons don't have Storybook, so no environment input
221+ -f npm-tag=latest
222+ continue-on-error : true
223+
224+ - name : Report failure
225+ if : steps.trigger.outcome == 'failure'
226+ run : |
227+ echo "::error title=Icons Publish Failed::Failed to trigger publish workflow for @equinor/eds-icons"
228+ echo "❌ Failed to trigger icons publish workflow" >> $GITHUB_STEP_SUMMARY
165229
166230 # Job 6: Trigger tokens publish workflow
167231 # Only runs if tokens package.json was changed
168232 trigger-tokens :
169233 needs : check-releases
170234 if : needs.check-releases.outputs.tokens == 'true'
171235 runs-on : ubuntu-latest
236+ outputs :
237+ failed : ${{ steps.trigger.outcome == 'failure' }}
172238 steps :
173239 - name : Trigger tokens publish
240+ id : trigger
174241 env :
175242 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
176243 run : |
177244 gh workflow run publish_tokens.yaml \
178245 --repo ${{ github.repository }} \
179- --ref fre/release-please \
246+ --ref develop \
180247 -f npm-tag=latest
248+ continue-on-error : true
249+
250+ - name : Report failure
251+ if : steps.trigger.outcome == 'failure'
252+ run : |
253+ echo "::error title=Tokens Publish Failed::Failed to trigger publish workflow for @equinor/eds-tokens"
254+ echo "❌ Failed to trigger tokens publish workflow" >> $GITHUB_STEP_SUMMARY
255+
256+ # Job 7: Summary report of all publish triggers
257+ # Runs after all trigger jobs complete (success or failure)
258+ # Provides a clear overview of which packages were published and which failed
259+ publish-summary :
260+ needs :
261+ - check-releases
262+ - trigger-core-react
263+ - trigger-lab-react
264+ - trigger-data-grid-react
265+ - trigger-icons
266+ - trigger-tokens
267+ # Always run this job, even if some trigger jobs failed
268+ if : always()
269+ runs-on : ubuntu-latest
270+ steps :
271+ - name : Generate summary report
272+ run : |
273+ echo "## 📦 Package Publish Trigger Summary" >> $GITHUB_STEP_SUMMARY
274+ echo "" >> $GITHUB_STEP_SUMMARY
275+ echo "This workflow triggered publish workflows for packages that had version changes." >> $GITHUB_STEP_SUMMARY
276+ echo "" >> $GITHUB_STEP_SUMMARY
277+ echo "### Results:" >> $GITHUB_STEP_SUMMARY
278+ echo "" >> $GITHUB_STEP_SUMMARY
279+
280+ # Check each package's trigger result
281+ if [ "${{ needs.check-releases.outputs.core-react }}" == "true" ]; then
282+ if [ "${{ needs.trigger-core-react.result }}" == "success" ]; then
283+ echo "- ✅ **@equinor/eds-core-react**: Publish workflow triggered successfully" >> $GITHUB_STEP_SUMMARY
284+ else
285+ echo "- ❌ **@equinor/eds-core-react**: Failed to trigger publish workflow" >> $GITHUB_STEP_SUMMARY
286+ fi
287+ else
288+ echo "- ⏭️ **@equinor/eds-core-react**: No changes, skipped" >> $GITHUB_STEP_SUMMARY
289+ fi
290+
291+ if [ "${{ needs.check-releases.outputs.lab-react }}" == "true" ]; then
292+ if [ "${{ needs.trigger-lab-react.result }}" == "success" ]; then
293+ echo "- ✅ **@equinor/eds-lab-react**: Publish workflow triggered successfully" >> $GITHUB_STEP_SUMMARY
294+ else
295+ echo "- ❌ **@equinor/eds-lab-react**: Failed to trigger publish workflow" >> $GITHUB_STEP_SUMMARY
296+ fi
297+ else
298+ echo "- ⏭️ **@equinor/eds-lab-react**: No changes, skipped" >> $GITHUB_STEP_SUMMARY
299+ fi
300+
301+ if [ "${{ needs.check-releases.outputs.data-grid-react }}" == "true" ]; then
302+ if [ "${{ needs.trigger-data-grid-react.result }}" == "success" ]; then
303+ echo "- ✅ **@equinor/eds-data-grid-react**: Publish workflow triggered successfully" >> $GITHUB_STEP_SUMMARY
304+ else
305+ echo "- ❌ **@equinor/eds-data-grid-react**: Failed to trigger publish workflow" >> $GITHUB_STEP_SUMMARY
306+ fi
307+ else
308+ echo "- ⏭️ **@equinor/eds-data-grid-react**: No changes, skipped" >> $GITHUB_STEP_SUMMARY
309+ fi
310+
311+ if [ "${{ needs.check-releases.outputs.icons }}" == "true" ]; then
312+ if [ "${{ needs.trigger-icons.result }}" == "success" ]; then
313+ echo "- ✅ **@equinor/eds-icons**: Publish workflow triggered successfully" >> $GITHUB_STEP_SUMMARY
314+ else
315+ echo "- ❌ **@equinor/eds-icons**: Failed to trigger publish workflow" >> $GITHUB_STEP_SUMMARY
316+ fi
317+ else
318+ echo "- ⏭️ **@equinor/eds-icons**: No changes, skipped" >> $GITHUB_STEP_SUMMARY
319+ fi
320+
321+ if [ "${{ needs.check-releases.outputs.tokens }}" == "true" ]; then
322+ if [ "${{ needs.trigger-tokens.result }}" == "success" ]; then
323+ echo "- ✅ **@equinor/eds-tokens**: Publish workflow triggered successfully" >> $GITHUB_STEP_SUMMARY
324+ else
325+ echo "- ❌ **@equinor/eds-tokens**: Failed to trigger publish workflow" >> $GITHUB_STEP_SUMMARY
326+ fi
327+ else
328+ echo "- ⏭️ **@equinor/eds-tokens**: No changes, skipped" >> $GITHUB_STEP_SUMMARY
329+ fi
330+
331+ echo "" >> $GITHUB_STEP_SUMMARY
332+ echo "---" >> $GITHUB_STEP_SUMMARY
333+ echo "" >> $GITHUB_STEP_SUMMARY
334+ echo "💡 **Note:** This workflow only triggers the publish workflows. Check individual publish workflow runs for actual publishing status." >> $GITHUB_STEP_SUMMARY
335+ echo "" >> $GITHUB_STEP_SUMMARY
336+ echo "📝 **eds-utils** is published as part of eds-core-react and does not have a separate publish workflow." >> $GITHUB_STEP_SUMMARY
337+
338+ - name : Check for any failures
339+ run : |
340+ # Check if any trigger job actually failed (by checking their outputs)
341+ # Note: We check the 'failed' output which is set based on step outcome
342+ # Jobs that were skipped will not have this output set to 'true'
343+ FAILED=false
344+
345+ if [ "${{ needs.trigger-core-react.outputs.failed }}" == "true" ]; then
346+ echo "::warning::trigger-core-react failed"
347+ FAILED=true
348+ fi
349+
350+ if [ "${{ needs.trigger-lab-react.outputs.failed }}" == "true" ]; then
351+ echo "::warning::trigger-lab-react failed"
352+ FAILED=true
353+ fi
354+
355+ if [ "${{ needs.trigger-data-grid-react.outputs.failed }}" == "true" ]; then
356+ echo "::warning::trigger-data-grid-react failed"
357+ FAILED=true
358+ fi
359+
360+ if [ "${{ needs.trigger-icons.outputs.failed }}" == "true" ]; then
361+ echo "::warning::trigger-icons failed"
362+ FAILED=true
363+ fi
364+
365+ if [ "${{ needs.trigger-tokens.outputs.failed }}" == "true" ]; then
366+ echo "::warning::trigger-tokens failed"
367+ FAILED=true
368+ fi
369+
370+ # Report final status
371+ if [ "$FAILED" == "true" ]; then
372+ echo "::error title=Some Publish Triggers Failed::One or more package publish workflows failed to trigger. Check the summary above for details."
373+ exit 1
374+ else
375+ echo "✅ All package publish workflows triggered successfully"
376+ fi
0 commit comments