feat: Add native gha cache support

Signed-off-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
Xuanwo
2023-01-11 08:44:40 +08:00
parent c484887f44
commit a3137a0ec8
2 changed files with 13 additions and 1 deletions

6
dist/index.js vendored
View File

@@ -66,7 +66,7 @@ function setup() {
console.log('sccache download from url: ', downloadUrl);
// Download and extract.
const sccachePackage = yield (0, tool_cache_1.downloadTool)(downloadUrl);
var sccachePath;
let sccachePath;
if (getExtension() == 'zip') {
sccachePath = yield (0, tool_cache_1.extractZip)(sccachePackage);
}
@@ -81,6 +81,10 @@ function setup() {
core.addPath(`${sccacheHome}`);
// Expose the sccache path as env.
core.exportVariable('SCCACHE_PATH', `${sccacheHome}/sccache`);
// Expose the gha cache related variable to make users eaiser to
// integrate with gha support.
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
});
}
function getFilename(version) {

View File

@@ -55,6 +55,14 @@ async function setup() {
core.addPath(`${sccacheHome}`);
// Expose the sccache path as env.
core.exportVariable('SCCACHE_PATH', `${sccacheHome}/sccache`);
// Expose the gha cache related variable to make users eaiser to
// integrate with gha support.
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable(
'ACTIONS_RUNTIME_TOKEN',
process.env.ACTIONS_RUNTIME_TOKEN || ''
);
}
function getFilename(version: string): Error | string {