Skip to content

Commit

Permalink
Fix cache to restore cache from correct arch
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdragon-001 authored and barthalion committed Feb 22, 2024
1 parent 2379671 commit a21be69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flatpak-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inputs:
cache-key:
description: >
Defines the cache-key to use.
Defaults to flatpak-builder-${sha256(manifestPath)}
Defaults to flatpak-builder-${arch}-${sha256(manifestPath)}
required: false
branch:
description: The flatpak branch.
Expand Down
7 changes: 3 additions & 4 deletions flatpak-builder/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/******/ var __webpack_modules__ = ({

/***/ 4682:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) {

const core = __nccwpck_require__(504)
const exec = __nccwpck_require__(4859)
Expand Down Expand Up @@ -72,7 +72,7 @@ class Configuration {
if (!this._cacheKey) {
try {
if (!this._manifestHash) { this._manifestHash = (await computeHash(this.manifestPath)).substring(0, 20) }
return `flatpak-builder-${this._manifestHash}-${this.arch}`
return `flatpak-builder-${this.arch}-${this._manifestHash}`
} catch (err) {
core.setFailed(`Fail to create create cache key based on manifest hash: ${err}`)
}
Expand Down Expand Up @@ -334,8 +334,7 @@ const prepareBuild = async (config) => {
[...CACHE_PATH], // TODO: drop once https://github.com/actions/toolkit/pull/1378 is merged
`${cacheKey}`,
[
'flatpak-builder-',
'flatpak-'
`flatpak-builder-${this.arch}-`
]
)
if (cacheHitKey !== undefined) {
Expand Down
5 changes: 2 additions & 3 deletions flatpak-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Configuration {
if (!this._cacheKey) {
try {
if (!this._manifestHash) { this._manifestHash = (await computeHash(this.manifestPath)).substring(0, 20) }
return `flatpak-builder-${this._manifestHash}-${this.arch}`
return `flatpak-builder-${this.arch}-${this._manifestHash}`
} catch (err) {
core.setFailed(`Fail to create create cache key based on manifest hash: ${err}`)
}
Expand Down Expand Up @@ -328,8 +328,7 @@ const prepareBuild = async (config) => {
[...CACHE_PATH], // TODO: drop once https://github.com/actions/toolkit/pull/1378 is merged
`${cacheKey}`,
[
'flatpak-builder-',
'flatpak-'
`flatpak-builder-${this.arch}-`
]
)
if (cacheHitKey !== undefined) {
Expand Down

0 comments on commit a21be69

Please sign in to comment.