@@ -3,12 +3,18 @@ name: Publish libraries
33on :
44 # Allows you to run this workflow manually from the Actions tab
55 workflow_dispatch :
6+ inputs :
7+ nightly_mode :
8+ description : ' Enable nightly change detection + skip publishing when no packages changed'
9+ required : false
10+ default : ' false'
11+ type : choice
12+ options :
13+ - ' false'
14+ - ' true'
615 push :
716 tags :
817 - " v**"
9- schedule :
10- # Run nightly at 1 AM UTC
11- - cron : ' 0 1 * * *'
1218
1319permissions :
1420 contents : read
1723 IS_UPSTREAM : ${{ github.repository_owner == 'Sofie-Automation' }}
1824 NPM_PACKAGE_SCOPE : ${{ vars.NPM_PACKAGE_SCOPE }} # In the form of nrkno, without the @
1925 NPM_PACKAGE_PREFIX : ${{ vars.NPM_PACKAGE_PREFIX }} # Set to anything to prefix the published package names with "sofie-". eg in combination with NPM_PACKAGE_SCOPE this will turn @sofie-automation/shared-lib into @nrkno/sofie-shared-lib
26+ IS_NIGHTLY : ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.nightly_mode == 'true') }}
2027
2128jobs :
2229 check-publish :
@@ -171,8 +178,8 @@ jobs:
171178 run : |
172179 cd packages
173180
174- # Default: publish for non-scheduled events
175- if [ "${{ github.event_name }}" != "schedule " ]; then
181+ # Default: publish for non-nightly events
182+ if [ "${{ env.IS_NIGHTLY }}" != "true " ]; then
176183 echo "should_publish=1" >> $GITHUB_OUTPUT
177184 exit 0
178185 fi
@@ -214,9 +221,9 @@ jobs:
214221 if [ -d "$PKG/dist" ]; then
215222 CURRENT_DIST_HASH=$(find "$PKG/dist" -type f -print0 | sort -z | xargs -0 cat | sha256sum | cut -c1-8)
216223 else
217- echo "📦 **$PKG**: No dist folder, will publish " >> $GITHUB_STEP_SUMMARY
218- HAS_ANY_CHANGES=1
219- continue
224+ echo "❌ **$PKG**: No dist folder after build " >> $GITHUB_STEP_SUMMARY
225+ echo "Build did not produce $PKG/dist; failing." >&2
226+ exit 1
220227 fi
221228
222229 if [ "$LAST_DIST_HASH" = "$CURRENT_DIST_HASH" ]; then
@@ -278,6 +285,9 @@ jobs:
278285 "
279286
280287 echo "Updated $PKG_DIR to $NEW_VERSION"
288+ else
289+ echo "Missing $PKG_DIR/dist after build; failing." >&2
290+ exit 1
281291 fi
282292 done
283293
@@ -295,22 +305,22 @@ jobs:
295305 CI : true
296306
297307 - name : Build OpenAPI client library
298- if : ${{ github.event_name != 'schedule ' || steps.detect.outputs.should_publish == '1' }}
308+ if : ${{ env.IS_NIGHTLY != 'true ' || steps.detect.outputs.should_publish == '1' }}
299309 run : |
300310 cd packages/openapi
301311 yarn build
302312 env :
303313 CI : true
304314 - name : Modify dependencies to use npm packages
305- if : ${{ github.event_name != 'schedule ' || steps.detect.outputs.should_publish == '1' }}
315+ if : ${{ env.IS_NIGHTLY != 'true ' || steps.detect.outputs.should_publish == '1' }}
306316 run : |
307317 node scripts/prepublish.js "${{ github.repository }}" "${{ env.NPM_PACKAGE_SCOPE }}" ${{ env.NPM_PACKAGE_PREFIX }}
308318
309319 cd packages
310320 yarn install --no-immutable
311321
312322 - name : Upload release artifact
313- if : ${{ github.event_name != 'schedule ' || steps.detect.outputs.should_publish == '1' }}
323+ if : ${{ env.IS_NIGHTLY != 'true ' || steps.detect.outputs.should_publish == '1' }}
314324 uses : actions/upload-artifact@v5
315325 with :
316326 name : publish-dist
@@ -331,7 +341,7 @@ jobs:
331341 - prepare-publish
332342 - test-packages
333343
334- if : ${{ github.event_name != 'schedule ' || needs.prepare-publish.outputs.should_publish == '1' }}
344+ if : ${{ env.IS_NIGHTLY != 'true ' || needs.prepare-publish.outputs.should_publish == '1' }}
335345
336346 permissions :
337347 contents : write
0 commit comments