mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-19 19:46:17 +02:00
v0.4.0
This commit is contained in:
parent
a51ff9983a
commit
e4a331f6ce
2 changed files with 14 additions and 4 deletions
9
dist/restore/index.js
vendored
9
dist/restore/index.js
vendored
|
@ -43299,6 +43299,7 @@ class CacheService {
|
||||||
}
|
}
|
||||||
saveCache(paths, key) {
|
saveCache(paths, key) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const cacheId = this.getCacheId(key);
|
||||||
const compressionMethod = yield utils.getCompressionMethod();
|
const compressionMethod = yield utils.getCompressionMethod();
|
||||||
const cachePaths = yield utils.resolvePaths(paths);
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
core.debug("Cache Paths:");
|
core.debug("Cache Paths:");
|
||||||
|
@ -43312,8 +43313,8 @@ class CacheService {
|
||||||
yield tar_1.listTar(archivePath, compressionMethod);
|
yield tar_1.listTar(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
||||||
core.debug(`Saving Cache (ID: ${key})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield this.uploadToS3(key, archivePath);
|
yield this.uploadToS3(cacheId, archivePath);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// Try to delete the archive to save space
|
// Try to delete the archive to save space
|
||||||
|
@ -43340,6 +43341,10 @@ class CacheService {
|
||||||
.promise();
|
.promise();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
getCacheId(primaryKey) {
|
||||||
|
var _a;
|
||||||
|
return `${(_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.replace("/", "-").toLowerCase()}-${primaryKey}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.CacheService = CacheService;
|
exports.CacheService = CacheService;
|
||||||
|
|
||||||
|
|
9
dist/save/index.js
vendored
9
dist/save/index.js
vendored
|
@ -43299,6 +43299,7 @@ class CacheService {
|
||||||
}
|
}
|
||||||
saveCache(paths, key) {
|
saveCache(paths, key) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const cacheId = this.getCacheId(key);
|
||||||
const compressionMethod = yield utils.getCompressionMethod();
|
const compressionMethod = yield utils.getCompressionMethod();
|
||||||
const cachePaths = yield utils.resolvePaths(paths);
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
core.debug("Cache Paths:");
|
core.debug("Cache Paths:");
|
||||||
|
@ -43312,8 +43313,8 @@ class CacheService {
|
||||||
yield tar_1.listTar(archivePath, compressionMethod);
|
yield tar_1.listTar(archivePath, compressionMethod);
|
||||||
}
|
}
|
||||||
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
||||||
core.debug(`Saving Cache (ID: ${key})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield this.uploadToS3(key, archivePath);
|
yield this.uploadToS3(cacheId, archivePath);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// Try to delete the archive to save space
|
// Try to delete the archive to save space
|
||||||
|
@ -43340,6 +43341,10 @@ class CacheService {
|
||||||
.promise();
|
.promise();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
getCacheId(primaryKey) {
|
||||||
|
var _a;
|
||||||
|
return `${(_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.replace("/", "-").toLowerCase()}-${primaryKey}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.CacheService = CacheService;
|
exports.CacheService = CacheService;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue