mirror of
https://github.com/ryanccn/attic-action.git
synced 2024-11-24 00:14:15 +00:00
feat: automatically configure Nix to use cache (#8)
This commit is contained in:
parent
88dbb4b600
commit
8c01d0bda1
2 changed files with 11 additions and 0 deletions
|
@ -19,6 +19,9 @@ inputs:
|
||||||
token:
|
token:
|
||||||
description: "Attic authorization token"
|
description: "Attic authorization token"
|
||||||
required: false
|
required: false
|
||||||
|
skip-use:
|
||||||
|
description: "Set to true to skip using attic cache as a substituter"
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node16"
|
using: "node16"
|
||||||
|
|
|
@ -9,10 +9,18 @@ export const configure = async () => {
|
||||||
const endpoint = core.getInput("endpoint");
|
const endpoint = core.getInput("endpoint");
|
||||||
const cache = core.getInput("cache");
|
const cache = core.getInput("cache");
|
||||||
const token = core.getInput("token");
|
const token = core.getInput("token");
|
||||||
|
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("attic", ["login", "--set-default", cache, endpoint, token]);
|
||||||
|
|
||||||
|
if (skipUse === "true") {
|
||||||
|
core.info('Not adding attic cache to substituters as skip-use is set to true');
|
||||||
|
} else {
|
||||||
|
core.info("Adding attic cache to substituters");
|
||||||
|
await exec.exec('attic', ['use', cache]);
|
||||||
|
}
|
||||||
|
|
||||||
core.info("Collecting store paths before build");
|
core.info("Collecting store paths before build");
|
||||||
await saveStorePaths();
|
await saveStorePaths();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue