Skip to content

Commit cab0a07

Browse files
Jm/intorg 644 spanish sync on staging Fixes INTORG-644 (#270)
* add english version of post * fix(ci): run strapi sync when rebuild skipped; match all src/content mdx * ci: trigger Strapi sync for .md/.mdx content and public media
1 parent a1c045e commit cab0a07

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/merge.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Build and Sync
22
# Runs on push to staging or playground only — not prod (prod has no Strapi instance, so no build or sync applies).
33
# Conditionally rebuilds the Strapi CMS on the self-hosted runner if cms/ changed,
4-
# and/or syncs MDX content and navigation JSON to Strapi if those files changed.
4+
# and/or syncs to Strapi when src/content changes (.md/.mdx), navigation JSON changes,
5+
# or static media under public/img/, public/uploads/, or public/documents/ changes.
56
# Does NOT trigger an Astro build — Astro is built and deployed separately via Netlify.
67

78
on:
@@ -49,7 +50,9 @@ jobs:
4950
uses: actions/github-script@v7
5051
with:
5152
script: |
52-
const contentPattern = /^src\/content\/(?:(?:foundation-pages|summit-pages|foundation-blog-posts|ambassadors)\/|[^/]+\/(?:foundation-pages|summit-pages|foundation-blog-posts|ambassadors)\/).+\.(md|mdx)$/
53+
// Any Markdown/MDX under Astro content collections (sync script only uploads configured roots).
54+
const contentPattern = /^src\/content\/.+\.(md|mdx)$/
55+
const mediaPattern = /^public\/(?:img|uploads|documents)\//
5356
const navigationPattern = /^src\/config\/(?:foundation-navigation|summit-navigation)\.json$/
5457
const zeroSha = '0000000000000000000000000000000000000000'
5558
@@ -167,8 +170,9 @@ jobs:
167170
168171
const cmsChanged =
169172
changedFiles.some((file) => file.startsWith('cms/'))
170-
const contentChanged =
171-
changedFiles.some((file) => contentPattern.test(file))
173+
const contentChanged = changedFiles.some(
174+
(file) => contentPattern.test(file) || mediaPattern.test(file)
175+
)
172176
const navigationChanged =
173177
changedFiles.some((file) => navigationPattern.test(file))
174178
@@ -177,7 +181,7 @@ jobs:
177181
}
178182
179183
if (contentChanged) {
180-
core.info('Content changes detected')
184+
core.info('Content or public media changes detected')
181185
}
182186
183187
if (navigationChanged) {
@@ -270,7 +274,11 @@ jobs:
270274
271275
sync-to-strapi:
272276
needs: [detect-changes, rebuild-strapi]
277+
# always() is required: if rebuild-strapi is skipped (no cms/ changes), GitHub would otherwise
278+
# skip this job before evaluating `if`, even when content/navigation changed.
273279
if: |
280+
always() &&
281+
needs.detect-changes.result == 'success' &&
274282
(needs.rebuild-strapi.result == 'success' || needs.rebuild-strapi.result == 'skipped') &&
275283
(needs.detect-changes.outputs.content_changed == 'true' || needs.detect-changes.outputs.navigation_changed == 'true')
276284
runs-on: ubuntu-latest
@@ -295,7 +303,7 @@ jobs:
295303
- name: Install dependencies
296304
run: pnpm install
297305

298-
- name: Sync MDX and navigation to Strapi
306+
- name: Sync content, media, and navigation to Strapi
299307
working-directory: cms
300308
run: |
301309
set -euo pipefail

0 commit comments

Comments
 (0)