This commit is contained in:
Domen Kožar 2019-10-03 17:41:53 +02:00
commit 01433080c8
No known key found for this signature in database
GPG key ID: C2FFBCAFD2C24246
3 changed files with 17 additions and 9 deletions

View file

@ -26,7 +26,7 @@ function run() {
const file = core.getInput('file');
const attributes = core.getInput('attributes');
const name = core.getInput('name', { required: true });
const signingKey = core.getInput('signingKey', { required: true });
const signingKey = core.getInput('signingKey');
const authToken = core.getInput('authToken');
core.startGroup('Installing Cachix');
// TODO: use cachix official installation link
@ -39,7 +39,9 @@ function run() {
core.startGroup(`Cachix: using ` + name);
yield exec.exec('cachix', ['use', name]);
core.endGroup();
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
if (signingKey !== "") {
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
}
// TODO: cachix use --watch-store
core.startGroup(`Invoking nix-build`);
let paths = '';
@ -50,12 +52,18 @@ function run() {
},
}
};
const args = strings_1.prependEach('-A', strings_1.nonEmptySplit(attributes, /\s/)).concat([file || "default.nix"]);
const args = strings_1.prependEach('-A', strings_1.nonEmptySplit(attributes, /\s+/)).concat([file || "default.nix"]);
yield exec.exec('nix-build', args, options);
core.endGroup();
core.startGroup(`Cachix: pushing to ` + name);
yield exec.exec('cachix', ['push', name].concat(strings_1.nonEmptySplit(paths, /\s/).join(' ')));
core.endGroup();
// Needed for PRs
if (signingKey !== "") {
core.startGroup(`Cachix: pushing to ` + name);
yield exec.exec('cachix', ['push', name].concat(strings_1.nonEmptySplit(paths, /\s+/)));
core.endGroup();
}
else {
console.log("No signing key. Assuming it's a pull request, nothing will be pushed.");
}
}
catch (error) {
core.setFailed(`Action failed with error: ${error}`);