A local staging workflow for Strapi and Contentful image uploads
Compress source images with @pipic/cli before uploading them to a headless CMS, while keeping originals available for rollback.
Run PiPic’s CLI on changed image assets, keep generated files out of repeat runs, and track usage against its monthly image quotas.
A CI image-compression job is easy to add and easy to make noisy. If it scans the whole repository on every run, it can spend quota on unchanged assets. If it writes results back into its own inputs, later runs may process those results again. The safer pattern is narrow: identify changed image files, process only those, and make the output location explicit.
PiPic’s open-source CLI, published as @pipic/cli on npm, is intended for scripts, CI and developer workflows. Its free tier covers 100 images per month; Pro covers 5,000. Treat those as image counts, not as a reason to compress the entire repository on every push.
Start by deciding whether CI should replace source assets or create a separate compressed output. PiPic’s CLI supports atomic in-place replacement or writing to a fresh directory. A separate output directory makes the pipeline boundary easier to see: source files remain inputs, and compressed files are generated artifacts. It also reduces the risk of a later run treating its own output as new source material.
Pick the asset paths the job is responsible for. For example, a repository might include a dedicated directory for web images. Filter for the formats PiPic compresses—JPG, PNG, WebP and AVIF—and exclude generated output, fixtures, or files that should remain untouched. Keeping that scope small is more reliable than trying to optimize every image-like file in a repository.
This is a GitHub Actions workflow that runs PiPic’s CLI, not a claim that you need a separate PiPic-specific action. Keeping the steps explicit makes it clearer which paths are processed and where the output goes.
Count images sent for processing across workflow runs, and compare that total with the monthly tier you use. A changed-file filter limits unnecessary work, but it does not guarantee you will stay under a quota: a large asset import or repeated runs can still consume it. Avoid rerunning the compression job when the input list has not changed, and check how your workflow handles retries before enabling automatic reruns.
For a small site, the free tier’s 100 images per month may be enough if CI processes only changed files. Teams regularly processing more can plan around the 5,000-image Pro tier. Do not assume that the quota is a per-run allowance; budget by month and track actual workflow inputs.
Before making the job required, test it with a small change. Confirm that it selects only the intended files, preserves the expected extensions, and places output where reviewers or later steps can find it. PiPic describes its output as staying in the original format, which is useful when URLs or build rules depend on file extensions. For more on that trade-off, see why retaining image formats can matter in existing web systems.
Start with one directory and a handful of changed images. Inspect the diff, verify that a second run with no image changes has no compression work to do, and watch the image count over the month. Expand the path scope only after that behavior is stable. A CI asset pipeline is useful when it catches the right files without surprising contributors—or quietly spending its monthly allowance on everything else.
Compress source images with @pipic/cli before uploading them to a headless CMS, while keeping originals available for rollback.
A review of npm package auditability, telemetry collection, and asset retention policies across modern terminal image compression utilities.
Clean client media handoffs require shrinking raw image folders quickly without account walls or watermarks.