
README for the latest.
Version 2 of cache-apt-pkgs-action is in release
candidate (v2.0.0-rc.1). It is a rewrite of the Bash version in TypeScript, and its inputs and outputs are
backwards compatible. I’d like people to try it before the first stable release.
Version 1 stays in maintenance mode and still gets patch updates. I wrote about it in Cache APT Packages v1 Released announcement.
Why a rewrite#
The Bash scripts grew too complex to read. The action needed arrays, maps, pattern matching and real logging,
without shell and environment quirks. TypeScript fit because GitHub maintains typed libraries for it
(@actions/core, @actions/cache, @actions/artifact), it needs no compiled binaries, and it allows unit
tests and smoke tests in CI. See the
v2 FAQ for more information.
The APT logic now lives in its own library, ts-apt.
Using it#
steps:
- uses: awalsh128/cache-apt-pkgs-action@v2.0.0
with:
packages: graphviz doxygen
version: 1.0Change version to start a fresh cache (e.g. after a runner image change). The action runs on node24, so
self-hosted runners need a runner version that supports it. GitHub-hosted runners already do.
v2 tag, on purpose. A tag that moves lets a compromised release changewhat your workflow runs. Pin an exact v2.*.* release or a full commit SHA. @v1 and @latest still point
at v1.
What changed inside#
- Logging: it uses native GitHub calls, so messages show up as run annotations.
- Output: it is more verbose for now, and I’ll tune that as the version matures.
- Artifacts: the manifests, cache key and logs are stored as workflow artifacts. A failed run uploads them anyway.
- Debug: turn it on with the
debuginput or in the repository settings.
Inputs and outputs#
packages- the space delimited list to install, with APT version syntax allowed (e.g.xdot=1.2-2)version- the cache version labelexecute_install_scripts- run each package’spreinstandpostinstscript after a restoreempty_packages_behavior-error,warnorignorewhenpackagesis emptydebug- more logging, plus the logs and manifests as an artifact
Outputs are cache-hit, package-version-list and all-package-version-list, which has the exact versions
installed (dependencies included) for audit logs.
Help wanted#
I’m looking for co-maintainers to help review changes and investigate issues. I haven’t had as much time for this action as I’d like, and I want it to stay responsive. If you’re interested, reach out on the repo.
The Version 2 FAQ covers the rest.