mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 08:43:55 +08: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) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const cacheId = this.getCacheId(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug("Cache Paths:");
|
||||
|
@ -43312,8 +43313,8 @@ class CacheService {
|
|||
yield tar_1.listTar(archivePath, compressionMethod);
|
||||
}
|
||||
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
||||
core.debug(`Saving Cache (ID: ${key})`);
|
||||
yield this.uploadToS3(key, archivePath);
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield this.uploadToS3(cacheId, archivePath);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
|
@ -43340,6 +43341,10 @@ class CacheService {
|
|||
.promise();
|
||||
});
|
||||
}
|
||||
getCacheId(primaryKey) {
|
||||
var _a;
|
||||
return `${(_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.replace("/", "-").toLowerCase()}-${primaryKey}`;
|
||||
}
|
||||
}
|
||||
exports.CacheService = CacheService;
|
||||
|
||||
|
|
9
dist/save/index.js
vendored
9
dist/save/index.js
vendored
|
@ -43299,6 +43299,7 @@ class CacheService {
|
|||
}
|
||||
saveCache(paths, key) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const cacheId = this.getCacheId(key);
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const cachePaths = yield utils.resolvePaths(paths);
|
||||
core.debug("Cache Paths:");
|
||||
|
@ -43312,8 +43313,8 @@ class CacheService {
|
|||
yield tar_1.listTar(archivePath, compressionMethod);
|
||||
}
|
||||
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
||||
core.debug(`Saving Cache (ID: ${key})`);
|
||||
yield this.uploadToS3(key, archivePath);
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield this.uploadToS3(cacheId, archivePath);
|
||||
}
|
||||
finally {
|
||||
// Try to delete the archive to save space
|
||||
|
@ -43340,6 +43341,10 @@ class CacheService {
|
|||
.promise();
|
||||
});
|
||||
}
|
||||
getCacheId(primaryKey) {
|
||||
var _a;
|
||||
return `${(_a = process.env["GITHUB_REPOSITORY"]) === null || _a === void 0 ? void 0 : _a.replace("/", "-").toLowerCase()}-${primaryKey}`;
|
||||
}
|
||||
}
|
||||
exports.CacheService = CacheService;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue