feat: cache the goreleaser binary

Look for GoReleaser in the runner tool cache before a download. This
makes a second use of the action in the same job, or any job on a
self-hosted runner, install immediately.

Add an opt-in `cache-binary` input that also stores the binary in the
GitHub Actions cache. When it hits, the action does not download the
release archive, the checksums and the signature bundle again. Cache
errors are not fatal and fall back to a download.

The runner tool cache entry is now keyed by distribution, so a Pro
binary is no longer returned for an OSS install of the same version.

Closes #476

Co-authored-by: timbretimber <105982513+timbretimber@users.noreply.github.com>
Co-authored-by: Akkuman <akkumans@qq.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2026-08-29 15:19:02 -03:00
co-authored by timbretimber Akkuman Copilot
parent 59060fdcfd
commit fa7c11c5a3
12 changed files with 1809 additions and 27 deletions
+14
View File
@@ -57,6 +57,20 @@ describe('install', () => {
const bin = await goreleaser.install('goreleaser-pro', 'latest');
expect(fs.existsSync(bin)).toBe(true);
}, 100000);
it('reuses the runner tool cache on a second install', async () => {
const first = await goreleaser.install('goreleaser', 'v2.15.3');
const second = await goreleaser.install('goreleaser', 'v2.15.3');
expect(second).toEqual(first);
expect(fs.existsSync(second)).toBe(true);
}, 100000);
it('does not share the tool cache between distributions', async () => {
const oss = await goreleaser.install('goreleaser', 'v2.15.3');
const pro = await goreleaser.install('goreleaser-pro', 'v2.15.3');
expect(pro).not.toEqual(oss);
expect(fs.existsSync(pro)).toBe(true);
}, 100000);
});
describe('distribSuffix', () => {
+1
View File
@@ -12,6 +12,7 @@ const baseInputs = (overrides: Partial<Inputs>): Inputs => ({
args: '',
workdir: '.',
installOnly: false,
cacheBinary: false,
...overrides
});