Skip to content

Tag images by commit and clean up old versions - #14

Merged
robertying merged 1 commit into
mainfrom
ci/image-tags
Oct 26, 2026
Merged

robertying merged 1 commit into
mainfrom
ci/image-tags

Conversation

@robertying

Copy link
Copy Markdown
Owner

What changes

  • The deploy job becomes an image job like cardinal's image.yml: buildx with the GitHub Actions layer cache, tags :<commit> and :latest, and an org.opencontainers.image.revision label.
  • After each push, dataaxiom/ghcr-cleanup-action keeps the newest 10 commit tags and deletes untagged versions. It understands manifest lists and attestations, so it doesn't delete the parts of tagged images.
  • The workflow token is read-only by default; only the image job gets packages: write.

Deploys don't change: the server still runs :latest through Watchtower, and the image name is the same.

Heads-up

  • The first push to main deletes old versions for good. Every untagged version left over from earlier pushes goes, since only :latest was ever tagged.
  • The image job only runs on pushes to main, so this PR's CI checks the workflow and the check job, not the image build.
  • If cleanup fails with a permission error, give this repository the Admin role on the package (package settings → Manage Actions access). The push has already happened by then.

🤖 Generated with Claude Code

The image job now uses buildx like cardinal: :<commit> and :latest tags,
an OCI revision label, the GitHub Actions layer cache, and cleanup that keeps
the newest 10 commit tags and deletes untagged leftovers. Watchtower still
deploys :latest. Workflows default to a read-only token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robertying
robertying merged commit 32bf145 into main Oct 26, 2026
2 checks passed
@robertying
robertying deleted the ci/image-tags branch October 26, 2026 10:42
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