mirror of
https://github.com/chickensoft-games/setup-godot.git
synced 2025-08-14 12:55:08 +00:00
Add option to disable cache (#85)
This commit is contained in:
parent
d83cb325fa
commit
46198e5e97
@ -66,6 +66,10 @@ inputs:
|
|||||||
description: >-
|
description: >-
|
||||||
True will also download the Godot Export Templates for each platform.
|
True will also download the Godot Export Templates for each platform.
|
||||||
default: false
|
default: false
|
||||||
|
cache:
|
||||||
|
description: >-
|
||||||
|
True to cache downloads.
|
||||||
|
default: true
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
21
dist/index.js
generated
vendored
21
dist/index.js
generated
vendored
@ -63,6 +63,7 @@ function run(platform) {
|
|||||||
const godotSharpRelease = core.getBooleanInput('godot-sharp-release');
|
const godotSharpRelease = core.getBooleanInput('godot-sharp-release');
|
||||||
const checkoutDirectory = (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : '';
|
const checkoutDirectory = (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : '';
|
||||||
const includeTemplates = core.getBooleanInput('include-templates');
|
const includeTemplates = core.getBooleanInput('include-templates');
|
||||||
|
const useCache = core.getBooleanInput('cache');
|
||||||
const userDir = os.homedir();
|
const userDir = os.homedir();
|
||||||
const downloadsDir = path_1.default.join(userDir, downloadsRelativePath);
|
const downloadsDir = path_1.default.join(userDir, downloadsRelativePath);
|
||||||
const installationDir = path_1.default.join(userDir, pathRelative);
|
const installationDir = path_1.default.join(userDir, pathRelative);
|
||||||
@ -134,7 +135,13 @@ function run(platform) {
|
|||||||
? [godotInstallationPath, exportTemplatePath]
|
? [godotInstallationPath, exportTemplatePath]
|
||||||
: [godotInstallationPath];
|
: [godotInstallationPath];
|
||||||
const cacheKey = includeTemplates ? godotUrl : `${godotUrl}-no-templates`;
|
const cacheKey = includeTemplates ? godotUrl : `${godotUrl}-no-templates`;
|
||||||
const cached = yield cache.restoreCache(cachedPaths.slice(), cacheKey);
|
let cached = undefined;
|
||||||
|
if (useCache) {
|
||||||
|
cached = yield cache.restoreCache(cachedPaths.slice(), cacheKey);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`⏭️ Not using cache`);
|
||||||
|
}
|
||||||
let executables;
|
let executables;
|
||||||
if (!cached) {
|
if (!cached) {
|
||||||
// Download Godot
|
// Download Godot
|
||||||
@ -183,11 +190,13 @@ function run(platform) {
|
|||||||
core.info(`✅ Files shown`);
|
core.info(`✅ Files shown`);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
// Save extracted Godot contents to cache
|
if (useCache) {
|
||||||
core.startGroup(`💾 Saving extracted Godot download to cache...`);
|
// Save extracted Godot contents to cache
|
||||||
yield cache.saveCache(cachedPaths, cacheKey);
|
core.startGroup(`💾 Saving extracted Godot download to cache...`);
|
||||||
core.info(`✅ Godot saved to cache`);
|
yield cache.saveCache(cachedPaths, cacheKey);
|
||||||
core.endGroup();
|
core.info(`✅ Godot saved to cache`);
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`🎉 Previous Godot download found in cache!`);
|
core.info(`🎉 Previous Godot download found in cache!`);
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
21
src/main.ts
21
src/main.ts
@ -26,6 +26,7 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
const godotSharpRelease = core.getBooleanInput('godot-sharp-release')
|
const godotSharpRelease = core.getBooleanInput('godot-sharp-release')
|
||||||
const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? ''
|
const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? ''
|
||||||
const includeTemplates = core.getBooleanInput('include-templates')
|
const includeTemplates = core.getBooleanInput('include-templates')
|
||||||
|
const useCache = core.getBooleanInput('cache')
|
||||||
|
|
||||||
const userDir = os.homedir()
|
const userDir = os.homedir()
|
||||||
const downloadsDir = path.join(userDir, downloadsRelativePath)
|
const downloadsDir = path.join(userDir, downloadsRelativePath)
|
||||||
@ -123,7 +124,13 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
? [godotInstallationPath, exportTemplatePath]
|
? [godotInstallationPath, exportTemplatePath]
|
||||||
: [godotInstallationPath]
|
: [godotInstallationPath]
|
||||||
const cacheKey = includeTemplates ? godotUrl : `${godotUrl}-no-templates`
|
const cacheKey = includeTemplates ? godotUrl : `${godotUrl}-no-templates`
|
||||||
const cached = await cache.restoreCache(cachedPaths.slice(), cacheKey)
|
let cached = undefined
|
||||||
|
|
||||||
|
if (useCache) {
|
||||||
|
cached = await cache.restoreCache(cachedPaths.slice(), cacheKey)
|
||||||
|
} else {
|
||||||
|
core.info(`⏭️ Not using cache`)
|
||||||
|
}
|
||||||
|
|
||||||
let executables: string[]
|
let executables: string[]
|
||||||
if (!cached) {
|
if (!cached) {
|
||||||
@ -217,11 +224,13 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save extracted Godot contents to cache
|
if (useCache) {
|
||||||
core.startGroup(`💾 Saving extracted Godot download to cache...`)
|
// Save extracted Godot contents to cache
|
||||||
await cache.saveCache(cachedPaths, cacheKey)
|
core.startGroup(`💾 Saving extracted Godot download to cache...`)
|
||||||
core.info(`✅ Godot saved to cache`)
|
await cache.saveCache(cachedPaths, cacheKey)
|
||||||
core.endGroup()
|
core.info(`✅ Godot saved to cache`)
|
||||||
|
core.endGroup()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
core.info(`🎉 Previous Godot download found in cache!`)
|
core.info(`🎉 Previous Godot download found in cache!`)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user