mirror of
https://github.com/prefix-dev/setup-pixi
synced 2026-10-08 15:04:08 +03:00
Add env path to cache key (#36)
This commit is contained in:
+6
-1
@@ -61228,7 +61228,12 @@ var import_promises = __toESM(require("fs/promises"));
|
||||
var import_path2 = __toESM(require("path"));
|
||||
var core3 = __toESM(require_core());
|
||||
var cache = __toESM(require_cache());
|
||||
var generateCacheKey = async (cacheKeyPrefix) => import_promises.default.readFile(options.pixiLockFile, "utf-8").then((content) => `${cacheKeyPrefix}${getCondaArch()}-${sha256(content)}`).catch((err) => {
|
||||
var generateCacheKey = async (cacheKeyPrefix) => import_promises.default.readFile(options.pixiLockFile, "utf-8").then((content) => {
|
||||
const contentsSha = sha256(content);
|
||||
const lockFileSha = sha256(options.pixiLockFile);
|
||||
const sha = sha256(contentsSha + lockFileSha);
|
||||
return `${cacheKeyPrefix}${getCondaArch()}-${sha}`;
|
||||
}).catch((err) => {
|
||||
throw new Error(`Failed to generate cache key: ${err}`);
|
||||
});
|
||||
var cachePath = import_path2.default.join(import_path2.default.dirname(options.pixiLockFile), ".pixi");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-pixi",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"private": true,
|
||||
"description": "Action to set up the pixi package manager.",
|
||||
"scripts": {
|
||||
|
||||
+8
-1
@@ -8,7 +8,14 @@ import { getCondaArch, sha256 } from './util'
|
||||
export const generateCacheKey = async (cacheKeyPrefix: string) =>
|
||||
fs
|
||||
.readFile(options.pixiLockFile, 'utf-8')
|
||||
.then((content) => `${cacheKeyPrefix}${getCondaArch()}-${sha256(content)}`)
|
||||
.then((content) => {
|
||||
const contentsSha = sha256(content)
|
||||
// the path to the lock file decides where the pixi env is created (../.pixi/env)
|
||||
// since conda envs are not relocatable, we need to include the path in the cache key
|
||||
const lockFileSha = sha256(options.pixiLockFile)
|
||||
const sha = sha256(contentsSha + lockFileSha)
|
||||
return `${cacheKeyPrefix}${getCondaArch()}-${sha}`
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error(`Failed to generate cache key: ${err}`)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user