Skip to content

Commit 2903c02

Browse files
Fix cache to restore cache from correct arch
1 parent f805c23 commit 2903c02

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
| `branch` | The default flatpak branch | Optional | `master` |
5353
| `cache` | Enable/Disable caching `.flatpak-builder` directory | Optional | `true` |
5454
| `restore-cache` | Enable/Disable cache restoring. If caching is enabled. | Optional | `true` |
55-
| `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-${sha256(manifestPath)}` |
55+
| `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)}` |
5656
| `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` |
5757
| `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - |
5858
| `gpg-sign` | The key to sign the package | Optional | - |
@@ -61,7 +61,7 @@ jobs:
6161

6262
#### Building for multiple CPU architectures
6363

64-
To build for CPU architectures other than `x86_64`, the GitHub Actions workflow has to either natively be running on that architecture (e.g. on an `aarch64` self-hosted GitHub Actions runner), or the container used must be configured to emulate the requested architecture (e.g. with QEMU).
64+
To build for CPU architectures other than `x86_64`, the GitHub Actions workflow has to either natively be running on that architecture (e.g. on an `cch64` self-hosted GitHub Actions runner), or the container used must be configured to emulate the requested architecture (e.g. with QEMU).
6565

6666
For example, to build a Flatpak for both `x86_64` and `aarch64` using emulation, use the following workflow as a guide:
6767

@@ -103,7 +103,7 @@ jobs:
103103
with:
104104
bundle: palette.flatpak
105105
manifest-path: org.gnome.zbrown.Palette.yml
106-
cache-key: flatpak-builder-${{ github.sha }}
106+
cache-key: flatpak-builder-${{ matrix.arch }}-${{ github.sha }}
107107
arch: ${{ matrix.arch }}
108108
```
109109

flatpak-builder/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ inputs:
5454
cache-key:
5555
description: >
5656
Defines the cache-key to use.
57-
Defaults to flatpak-builder-${sha256(manifestPath)}
57+
Defaults to flatpak-builder-${arch}-${sha256(manifestPath)}
5858
required: false
5959
branch:
6060
description: The flatpak branch.

flatpak-builder/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Configuration {
6666
if (!this._cacheKey) {
6767
try {
6868
if (!this._manifestHash) { this._manifestHash = (await computeHash(this.manifestPath)).substring(0, 20) }
69-
return `flatpak-builder-${this._manifestHash}-${this.arch}`
69+
return `flatpak-builder-${this.arch}-${this._manifestHash}`
7070
} catch (err) {
7171
core.setFailed(`Fail to create create cache key based on manifest hash: ${err}`)
7272
}
@@ -328,8 +328,7 @@ const prepareBuild = async (config) => {
328328
CACHE_PATH,
329329
`${cacheKey}`,
330330
[
331-
'flatpak-builder-',
332-
'flatpak-'
331+
`flatpak-builder-${this.arch}`
333332
]
334333
)
335334
if (cacheHitKey !== undefined) {

0 commit comments

Comments
 (0)