From cf8fa6ba7729e41769d2c7b715c82cb2cba7d78f Mon Sep 17 00:00:00 2001 From: Lukas Waslowski Date: Mon, 10 Aug 2026 15:39:33 +0200 Subject: [PATCH] flatpak-builder: Add saveCache flag --- README.md | 1 + flatpak-builder/action.yml | 6 ++++++ flatpak-builder/dist/index.js | 4 +++- flatpak-builder/index.js | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9dda4ee..ce8d498 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ jobs: | `branch` | The default flatpak branch | Optional | `master` | | `cache` | Enable/Disable caching `.flatpak-builder` directory | Optional | `true` | | `restore-cache` | Enable/Disable cache restoring. If caching is enabled. | Optional | `true` | +| `save-cache` | Enable/Disable cache uploading. If caching is enabled. | Optional | `true` | | `cache-key` | Specifies the cache key. CPU arch is automatically added, so there is no need to add it to the cache key. | Optional | `flatpak-builder-${arch}-${sha256(manifestPath)}` | | `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` | | `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - | diff --git a/flatpak-builder/action.yml b/flatpak-builder/action.yml index 9152e38..f383e9b 100644 --- a/flatpak-builder/action.yml +++ b/flatpak-builder/action.yml @@ -55,6 +55,12 @@ inputs: Possible values: true, enabled, yes, y. Or something else to disable it. default: "true" required: false + save-cache: + description: > + Toggles saving the cache. + Possible values: true, enabled, yes, y. Or something else to disable it. + default: "true" + required: false cache-key: description: > Defines the cache-key to use. diff --git a/flatpak-builder/dist/index.js b/flatpak-builder/dist/index.js index 04fecf3..8a2e09d 100644 --- a/flatpak-builder/dist/index.js +++ b/flatpak-builder/dist/index.js @@ -41,6 +41,8 @@ class Configuration { this.debugBundle = this.bundle.replace('.flatpak', '') + '-debug.flatpak' // Whether to restore the cache or not this.restoreCache = core.getBooleanInput('restore-cache') + // Whether to save the cache or not + this.saveCache = core.getBooleanInput('save-cache') // Whether to enable caching the build directory this.cacheBuildDir = core.getBooleanInput('cache') // The repository used to install the runtime from @@ -269,7 +271,7 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => { await exec.exec('xvfb-run --auto-servernum flatpak-builder', args) - if (config.cacheBuildDir && (cacheKey !== cacheHitKey)) { + if (config.cacheBuildDir && config.saveCache && (cacheKey !== cacheHitKey)) { await cache.saveCache( CACHE_PATH, cacheKey diff --git a/flatpak-builder/index.js b/flatpak-builder/index.js index 4c963c6..6e7a0e2 100644 --- a/flatpak-builder/index.js +++ b/flatpak-builder/index.js @@ -35,6 +35,8 @@ class Configuration { this.debugBundle = this.bundle.replace('.flatpak', '') + '-debug.flatpak' // Whether to restore the cache or not this.restoreCache = core.getBooleanInput('restore-cache') + // Whether to save the cache or not + this.saveCache = core.getBooleanInput('save-cache') // Whether to enable caching the build directory this.cacheBuildDir = core.getBooleanInput('cache') // The repository used to install the runtime from @@ -263,7 +265,7 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => { await exec.exec('xvfb-run --auto-servernum flatpak-builder', args) - if (config.cacheBuildDir && (cacheKey !== cacheHitKey)) { + if (config.cacheBuildDir && config.saveCache && (cacheKey !== cacheHitKey)) { await cache.saveCache( CACHE_PATH, cacheKey