Skip to content

Commit 10a5dbc

Browse files
committed
flatpak-builder: Add saveCache flag
1 parent 8e357b1 commit 10a5dbc

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
| `branch` | The default flatpak branch | Optional | `master` |
5454
| `cache` | Enable/Disable caching `.flatpak-builder` directory | Optional | `true` |
5555
| `restore-cache` | Enable/Disable cache restoring. If caching is enabled. | Optional | `true` |
56+
| `save-cache` | Enable/Disable cache uploading. If caching is enabled. | Optional | `true` |
5657
| `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)}` |
5758
| `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` |
5859
| `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - |

‎flatpak-builder/action.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ inputs:
5555
Possible values: true, enabled, yes, y. Or something else to disable it.
5656
default: "true"
5757
required: false
58+
save-cache:
59+
description: >
60+
Toggles saving the cache.
61+
Possible values: true, enabled, yes, y. Or something else to disable it.
62+
default: "true"
63+
required: false
5864
cache-key:
5965
description: >
6066
Defines the cache-key to use.

‎flatpak-builder/index.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Configuration {
3535
this.debugBundle = this.bundle.replace('.flatpak', '') + '-debug.flatpak'
3636
// Whether to restore the cache or not
3737
this.restoreCache = core.getBooleanInput('restore-cache')
38+
// Whether to save the cache or not
39+
this.saveCache = core.getBooleanInput('save-cache')
3840
// Whether to enable caching the build directory
3941
this.cacheBuildDir = core.getBooleanInput('cache')
4042
// The repository used to install the runtime from
@@ -263,7 +265,7 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => {
263265

264266
await exec.exec('xvfb-run --auto-servernum flatpak-builder', args)
265267

266-
if (config.cacheBuildDir && (cacheKey !== cacheHitKey)) {
268+
if (config.cacheBuildDir && config.saveCache && (cacheKey !== cacheHitKey)) {
267269
await cache.saveCache(
268270
CACHE_PATH,
269271
cacheKey

0 commit comments

Comments
 (0)