Skip to content

fix: get publising working#4

Open
DNR500 wants to merge 1 commit into
code-classroomfrom
fix/code-classroom-build-and-publish-set-up
Open

fix: get publising working#4
DNR500 wants to merge 1 commit into
code-classroomfrom
fix/code-classroom-build-and-publish-set-up

Conversation

@DNR500
Copy link
Copy Markdown

@DNR500 DNR500 commented May 21, 2026

Summary

Fix CI publish of @RaspberryPiFoundation/scratch-gui to GitHub Packages by skipping npm lifecycle scripts during npm publish. The existing prepublishOnly hook blocks all publishes (including CI).

Problem

CI on code-classroom runs npm publish for @RaspberryPiFoundation/scratch-gui after a successful build. Publish fails because packages/scratch-gui defines a prepublishOnly script that always exits with code 1 to discourage manual publishes. npm runs that hook on every publish, including CI, so the job never uploads to GitHub Packages.

npm version in the same step succeeds; the failure happens when npm publish triggers prepublishOnly.

CI error

https://github.com/RaspberryPiFoundation/scratch-editor/actions/runs/26237618439/job/77215053999

Run RELEASE_VERSION="13.7.3-code-classroom.$(date +'%Y%m%d%H%M%S')"
  RELEASE_VERSION="13.7.3-code-classroom.$(date +'%Y%m%d%H%M%S')"
  npm version --no-git-tag-version "$RELEASE_VERSION"
  npm publish --access public --tag latest
  shell: /usr/bin/bash -e {0}
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
    NPM_AUTH_TOKEN: ***
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
@RaspberryPiFoundation/scratch-gui
v13.7.3-code-classroom.20260521160858

removed 1 package, and changed 1 package in 4s

516 packages are looking for funding
  run `npm fund` for details
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.

> @RaspberryPiFoundation/scratch-gui@13.7.3-code-classroom.20260521160858 prepublishOnly
> echo "Please publish through CI only." && exit 1

Please publish through CI only.
npm error code 1
npm error path /home/runner/work/scratch-editor/scratch-editor/packages/scratch-gui
npm error command failed
npm error command sh -c echo "Please publish through CI only." && exit 1
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2026-05-21T16_09_02_784Z-debug-0.log
Error: Process completed with exit code 1.

Solution

Add --ignore-scripts to the publish step in .github/workflows/ci.yml:

npm publish --access public --tag latest --ignore-scripts

Why this should work

  • The monorepo build job already runs npm run build, so dist/ is present before publish. Skipping lifecycle scripts at publish time does not skip the build.
  • prepublishOnly is intended to block local npm publish; npm does not distinguish CI from a developer machine. --ignore-scripts skips that hook so GPR publish can complete.
  • Only the CI publish command changes; prepublishOnly in package.json still discourages manual publishes from a laptop.

Test plan

  • Merge to code-classroom (or push this branch and merge via PR).
  • Confirm CI Publish scratch-gui to GitHub Packages succeeds.
  • Confirm a new version appears on GitHub Packages — scratch-gui as 13.7.3-code-classroom.<timestamp>.

@DNR500 DNR500 self-assigned this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant