Skip to content

ci: make Docker Hub push conditional on configured secrets - #9

Merged
im-pingo merged 1 commit into
mainfrom
ci/docker-build-optional-push
Aug 3, 2026
Merged

ci: make Docker Hub push conditional on configured secrets#9
im-pingo merged 1 commit into
mainfrom
ci/docker-build-optional-push

Conversation

@im-pingo

@im-pingo im-pingo commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

The post-merge Docker Build job on main failed with Username and password required — the DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets are not configured in this repository, and docker/login-action hard-fails when both are empty.

This change adds a credential gate step:

  • Secrets configured → login and push multi-arch (linux/amd64,linux/arm64) exactly as before
  • Secrets missing → skip login, run a build-only linux/amd64 smoke test (no push), and note it in the job summary

The Dockerfile keeps getting validated on every main push either way, and forks without secrets get green CI.

Test plan

  • YAML syntax validated locally
  • CI on this PR passes (docker job itself only runs on main)
  • After merge: Docker Build job on main goes green (build-only mode)
  • Optional follow-up: configure DOCKERHUB_USERNAME/DOCKERHUB_TOKEN in repo settings to re-enable image publishing

The Docker Build job failed on main with 'Username and password
required' because DOCKERHUB_USERNAME/DOCKERHUB_TOKEN secrets are not
configured in this repository.

Detect credential availability in a gate step: with secrets, login and
push multi-arch as before; without, run a build-only amd64 smoke test
so the Dockerfile is still validated on every main push.
@im-pingo
im-pingo merged commit ed0164f into main Aug 3, 2026
4 checks passed
@im-pingo
im-pingo deleted the ci/docker-build-optional-push branch August 3, 2026 13:29
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