Earthly "RUN --push only allowed" / --push not enabled in CI
Earthly separates building from pushing. RUN --push and SAVE IMAGE --push execute only when you pass --push on the earthly command line. Without it, push steps are skipped or rejected, so nothing reaches the registry.
What this error means
A push step is skipped, or Earthly reports a push-only command is not allowed, because the build was invoked without the top-level --push flag.
+deploy | RUN --push ./publish.sh
Error: RUN --push is only allowed when the build is invoked with earthly --pushCommon causes
The build ran without --push
Push-only commands are gated behind the top-level --push flag so builds are side-effect free by default. Without it, they do not run.
Push logic placed outside a --push guarded step
A registry push runs in a normal RUN rather than a RUN --push, so it either always runs or never runs as intended.
How to fix it
Invoke earthly with --push
Pass --push at the command line so RUN --push and SAVE IMAGE --push execute.
earthly --push +deployGate side effects behind --push
Mark registry and deploy commands with --push so they only run in the pushing invocation.
deploy:
BUILD +image
RUN --push ./publish.shHow to prevent it
- Use --push only on branches that should publish.
- Keep side effects inside RUN --push / SAVE IMAGE --push.
- Run PR builds without --push so they never publish.