Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
22c2bb1406 | |||
8e8ff90bd6 | |||
|
5619ef4781 | ||
|
37f74ba5fa | ||
|
6cfb1137df |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ github.event.release.tag_name }}
|
ref: ${{ github.event.release.tag_name }}
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2
|
- uses: pnpm/action-setup@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2
|
- uses: pnpm/action-setup@v3
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
run: pnpm install && pnpm build
|
run: pnpm install && pnpm build
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@v7
|
uses: DeterminateSystems/nix-installer-action@v9
|
||||||
|
|
||||||
- name: Setup Attic Cache
|
- name: Setup Attic Cache
|
||||||
uses: ./
|
uses: ./
|
||||||
|
8
dist/index.js
vendored
Normal file
8
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
src/index.ts
10
src/index.ts
@ -1,12 +1,16 @@
|
|||||||
import { install } from "./stages/install";
|
import { install, isInstalled } from "./stages/install";
|
||||||
import { configure } from "./stages/configure";
|
import { configure } from "./stages/configure";
|
||||||
import { push } from "./stages/push";
|
import { push } from "./stages/push";
|
||||||
import { getState, saveState } from "@actions/core";
|
import { getState, saveState, info } from "@actions/core";
|
||||||
|
|
||||||
const isPost = !!getState("isPost");
|
const isPost = !!getState("isPost");
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
await install();
|
if (await isInstalled()) {
|
||||||
|
info("Skipping attic installation because it is already installed");
|
||||||
|
} else {
|
||||||
|
await install();
|
||||||
|
}
|
||||||
await configure();
|
await configure();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,13 +12,13 @@ export const configure = async () => {
|
|||||||
const skipUse = core.getInput("skip-use");
|
const skipUse = core.getInput("skip-use");
|
||||||
|
|
||||||
core.info("Logging in to attic cache");
|
core.info("Logging in to attic cache");
|
||||||
await exec("attic", ["login", "--set-default", cache, endpoint, token]);
|
await exec("/run/current-system/sw/bin/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("attic", ["use", cache]);
|
await exec("/run/current-system/sw/bin/attic", ["use", cache]);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info("Collecting store paths before build");
|
core.info("Collecting store paths before build");
|
||||||
|
@ -33,3 +33,8 @@ export const install = async () => {
|
|||||||
|
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isInstalled = async () => {
|
||||||
|
let return_code = await exec("/run/current-system/sw/bin/attic", ["-V"]);
|
||||||
|
return return_code === 0;
|
||||||
|
};
|
||||||
|
@ -28,7 +28,7 @@ export const push = async () => {
|
|||||||
|
|
||||||
const splitAddedPaths = splitArray(addedPaths, 25);
|
const splitAddedPaths = splitArray(addedPaths, 25);
|
||||||
for (const addedPaths of splitAddedPaths) {
|
for (const addedPaths of splitAddedPaths) {
|
||||||
await exec("attic", ["push", cache, ...addedPaths]);
|
await exec("/run/current-system/sw/bin/attic", ["push", cache, ...addedPaths]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user