mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-29 13:30:03 +00:00
Add autoclean.
This commit is contained in:
parent
8cbd5dda6b
commit
293503e099
2 changed files with 9 additions and 0 deletions
4
index.ts
4
index.ts
|
@ -171,6 +171,10 @@ async function installBins() {
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map((bin) => (bin.startsWith('cargo-') ? bin : `cargo-${bin}`));
|
.map((bin) => (bin.startsWith('cargo-') ? bin : `cargo-${bin}`));
|
||||||
|
|
||||||
|
if (core.getBooleanInput('cache')) {
|
||||||
|
bins.push('cargo-cache');
|
||||||
|
}
|
||||||
|
|
||||||
if (bins.length === 0) {
|
if (bins.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
5
post.ts
5
post.ts
|
@ -1,5 +1,6 @@
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
import { getPathsToCache, getPrimaryCacheKey } from './helpers';
|
import { getPathsToCache, getPrimaryCacheKey } from './helpers';
|
||||||
|
|
||||||
async function saveCache() {
|
async function saveCache() {
|
||||||
|
@ -17,6 +18,10 @@ async function saveCache() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.info('Cleaning cache before saving');
|
||||||
|
|
||||||
|
await exec.exec('cargo', ['cache', '--autoclean']);
|
||||||
|
|
||||||
core.info(`Saving cache with key ${primaryKey}`);
|
core.info(`Saving cache with key ${primaryKey}`);
|
||||||
|
|
||||||
await cache.saveCache(getPathsToCache(), primaryKey, {}, false);
|
await cache.saveCache(getPathsToCache(), primaryKey, {}, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue