mirror of
https://codeberg.org/icewind/attic-action.git
synced 2026-06-03 17:44:07 +02:00
Support private caches
This commit is contained in:
parent
70e7e680d7
commit
453bd5c328
6 changed files with 56 additions and 29 deletions
16
src/main.ts
16
src/main.ts
|
|
@ -7,16 +7,22 @@ async function run() {
|
|||
// inputs
|
||||
const file = core.getInput('file');
|
||||
const attributes = core.getInput('attributes');
|
||||
const cachixPush = core.getInput('cachixPush', { required: true });
|
||||
const push = core.getInput('push', { required: true });
|
||||
const signingKey = core.getInput('signingKey', { required: true });
|
||||
const authToken = core.getInput('authToken')
|
||||
|
||||
core.startGroup('Installing Cachix')
|
||||
// TODO: use cachix official installation link
|
||||
await exec.exec('nix-env', ['-iA', 'cachix', '-f', 'https://github.com/NixOS/nixpkgs/tarball/ab5863afada3c1b50fc43bf774b75ea71b287cde']);
|
||||
core.endGroup()
|
||||
|
||||
core.startGroup(`Cachix: using ` + cachixPush);
|
||||
await exec.exec('cachix', ['use', cachixPush]);
|
||||
// for private caches
|
||||
if (authToken !== "") {
|
||||
await exec.exec('cachix', ['authtoken', authToken]);
|
||||
}
|
||||
|
||||
core.startGroup(`Cachix: using ` + push);
|
||||
await exec.exec('cachix', ['use', push]);
|
||||
core.endGroup()
|
||||
|
||||
core.exportVariable('CACHIX_SIGNING_KEY', signingKey)
|
||||
|
|
@ -35,8 +41,8 @@ async function run() {
|
|||
await exec.exec('nix-build', args, options);
|
||||
core.endGroup()
|
||||
|
||||
core.startGroup(`Cachix: pushing to ` + cachixPush);
|
||||
await exec.exec('cachix', ['push', cachixPush].concat(saneSplit(paths, /\s/).join(' ')));
|
||||
core.startGroup(`Cachix: pushing to ` + push);
|
||||
await exec.exec('cachix', ['push', push].concat(saneSplit(paths, /\s/).join(' ')));
|
||||
core.endGroup()
|
||||
} catch (error) {
|
||||
core.setFailed(`Action failed with error: ${error}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue