Skip to content

feat: harmont GitHub Action with Docker image caching#2

Merged
markovejnovic merged 21 commits into
mainfrom
initial-setup
May 27, 2026
Merged

feat: harmont GitHub Action with Docker image caching#2
markovejnovic merged 21 commits into
mainfrom
initial-setup

Conversation

@markovejnovic
Copy link
Copy Markdown
Contributor

@markovejnovic markovejnovic commented May 27, 2026

No description provided.

Resolves user-provided version input (latest, 1.2.3, v1.2.3) into a
concrete release tag. Uses CURL_CMD env var for testability.
- Pass user inputs via env vars instead of inline ${{ }} interpolation
  in run blocks (prevents script injection in action.yml and setup/action.yml)
- Check cache directory contents instead of cache-hit output for prefix
  matches in cache-restore (prefix restores don't set cache-hit=true)
- Add GITHUB_TOKEN auth header to GitHub API calls in resolve-version.sh
  (avoids 60 req/hr unauthenticated rate limit on shared runners)
- Add actions/cache step in setup/ keyed on version + OS + arch
- Skip download entirely on cache hit (instant setup on repeat runs)
- Remove install-python-dsl input — hm embeds its own DSL engine
- Add setup-cached test job to verify cache behavior
New cache-backend input: 'gha' (default, existing behavior) or
'registry' (pushes/pulls images to a container registry).

Registry backend advantages over GHA cache:
- No 10GB size limit (GHCR storage is separate)
- Native Docker layer deduplication (shared base layers stored once)
- Per-image granularity (only changed images push/pull)
- Faster for large images (Docker pull vs untar from GHA cache)

Usage:
  - uses: harmont-dev/actions-hm@v1
    with:
      pipeline: ci
      cache-backend: registry
    permissions:
      packages: write

Images stored at ghcr.io/<owner>/<repo>/harmont-cache/<step>:<hash>
Breaking: removed GHA cache backend entirely. All Docker image
caching now goes through a container registry (GHCR by default).

Cache save now includes automatic cleanup:
- After pushing current images, queries GitHub Packages API for
  stale versions of each step's image
- Keeps N previous versions (configurable via cleanup-keep, default 2)
- Deletes older versions to prevent unbounded registry growth
- Requires packages:delete permission (gracefully skips if denied)

Manifest stored as a scratch image (ghcr.io/.../manifest:latest)
so restore can bootstrap without prior local state.
@markovejnovic markovejnovic merged commit 6857e6d into main May 27, 2026
3 of 7 checks passed
@markovejnovic markovejnovic deleted the initial-setup branch May 27, 2026 14:41
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