Compare commits
5 Commits
v0.2.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fe40381c3 | ||
|
|
5619ef4781 | ||
|
|
37f74ba5fa | ||
|
|
6cfb1137df | ||
|
|
f75ac4b827 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: pnpm
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: pnpm
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
run: pnpm install && pnpm build
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v7
|
||||
uses: DeterminateSystems/nix-installer-action@v9
|
||||
|
||||
- name: Setup Attic Cache
|
||||
uses: ./
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { install } from "./stages/install";
|
||||
import { install, isInstalled } from "./stages/install";
|
||||
import { configure } from "./stages/configure";
|
||||
import { push } from "./stages/push";
|
||||
import { getState, saveState } from "@actions/core";
|
||||
import { getState, saveState, info } from "@actions/core";
|
||||
|
||||
const isPost = !!getState("isPost");
|
||||
|
||||
const main = async () => {
|
||||
if (await isInstalled()) {
|
||||
info("Skipping attic installation because it is already installed");
|
||||
} else {
|
||||
await install();
|
||||
}
|
||||
await configure();
|
||||
};
|
||||
|
||||
|
||||
@@ -33,3 +33,8 @@ export const install = async () => {
|
||||
|
||||
core.endGroup();
|
||||
};
|
||||
|
||||
export const isInstalled = async () => {
|
||||
let return_code = await exec("attic", ["-V"]);
|
||||
return return_code === 0;
|
||||
};
|
||||
|
||||
@@ -6,5 +6,12 @@ export const saveStorePaths = async () => {
|
||||
await exec("sh", ["-c", "nix path-info --all --json > /tmp/store-paths"]);
|
||||
};
|
||||
export const getStorePaths = async () => {
|
||||
return (JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[]).map((path) => path.path);
|
||||
const rawStorePaths = JSON.parse(await readFile("/tmp/store-paths", "utf8")) as { path: string }[];
|
||||
|
||||
// compatibility with Nix 2.18
|
||||
if (Array.isArray(rawStorePaths)) {
|
||||
return rawStorePaths.map((path) => path.path);
|
||||
};
|
||||
|
||||
return Object.keys(rawStorePaths);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user