forked from Mirror/attic-action
fix: various fixes
This commit is contained in:
parent
8c01d0bda1
commit
ce977ffab4
3 changed files with 7 additions and 4 deletions
|
@ -15,10 +15,10 @@ export const configure = async () => {
|
||||||
await exec("attic", ["login", "--set-default", cache, endpoint, token]);
|
await exec("attic", ["login", "--set-default", cache, endpoint, token]);
|
||||||
|
|
||||||
if (skipUse === "true") {
|
if (skipUse === "true") {
|
||||||
core.info('Not adding attic cache to substituters as skip-use is set to true');
|
core.info("Not adding attic cache to substituters as skip-use is set to true");
|
||||||
} else {
|
} else {
|
||||||
core.info("Adding attic cache to substituters");
|
core.info("Adding attic cache to substituters");
|
||||||
await exec.exec('attic', ['use', cache]);
|
await exec("attic", ["use", cache]);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info("Collecting store paths before build");
|
core.info("Collecting store paths before build");
|
||||||
|
|
|
@ -3,17 +3,20 @@ import { exec } from "@actions/exec";
|
||||||
|
|
||||||
import splitArray from "just-split";
|
import splitArray from "just-split";
|
||||||
import { saveStorePaths, getStorePaths } from "../utils";
|
import { saveStorePaths, getStorePaths } from "../utils";
|
||||||
|
|
||||||
export const push = async () => {
|
export const push = async () => {
|
||||||
core.startGroup("Push to Attic");
|
core.startGroup("Push to Attic");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const skipPush = core.getInput("skip-push");
|
const skipPush = core.getInput("skip-push");
|
||||||
|
|
||||||
if (skipPush === "true") {
|
if (skipPush === "true") {
|
||||||
core.info("Pushing to cache is disabled by skip-push");
|
core.info("Pushing to cache is disabled by skip-push");
|
||||||
} else {
|
} else {
|
||||||
const cache = core.getInput("cache");
|
const cache = core.getInput("cache");
|
||||||
|
|
||||||
core.info("Pushing to cache");
|
core.info("Pushing to cache");
|
||||||
|
|
||||||
const oldPaths = await getStorePaths();
|
const oldPaths = await getStorePaths();
|
||||||
await saveStorePaths();
|
await saveStorePaths();
|
||||||
const newPaths = await getStorePaths();
|
const newPaths = await getStorePaths();
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { exec } from "@actions/exec";
|
||||||
import { readFile } from "node:fs/promises";
|
import { readFile } from "node:fs/promises";
|
||||||
|
|
||||||
export const saveStorePaths = async () => {
|
export const saveStorePaths = async () => {
|
||||||
await exec("sh", ["-c", "nix path-info --all --json > /tmp/store-paths"]);
|
await exec("sh", ["-c", "nix path-info --all --json > /tmp/store-paths"]);
|
||||||
};
|
};
|
||||||
export const getStorePaths = async () => {
|
export const getStorePaths = async () => {
|
||||||
return JSON.parse(await readFile("/tmp/store-paths", "utf8")).map((path) => path.path);
|
return (JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[]).map((path) => path.path);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue