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

@ -14,7 +14,7 @@ jobs:
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- uses: cachix/install-nix-action@v2
- uses: cachix/install-nix-action@v3
- name: Test public cache
uses: ./
with:

View file

@ -25,8 +25,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: cachix/install-nix-action@v2
- uses: cachix/cachix-action@v1
- uses: cachix/install-nix-action@v3
- uses: cachix/cachix-action@v2
with:
name: cachix-action
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

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();
if (signingKey !== "") {
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
}
// TODO: cachix use --watch-store
core.startGroup(`Invoking nix-build`);
let paths = '';
@ -50,13 +52,19 @@ 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();
// Needed for PRs
if (signingKey !== "") {
core.startGroup(`Cachix: pushing to ` + name);
yield exec.exec('cachix', ['push', name].concat(strings_1.nonEmptySplit(paths, /\s/).join(' ')));
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}`);
throw (error);