mirror of
https://codeberg.org/icewind/attic-action.git
synced 2026-06-03 17:44:07 +02:00
allow auth token to be enough for pushing paths
This commit is contained in:
parent
e689c31e6e
commit
25971529fd
2 changed files with 18 additions and 8 deletions
12
dist/main/index.js
vendored
12
dist/main/index.js
vendored
|
|
@ -1052,7 +1052,7 @@ function setup() {
|
||||||
core.startGroup('Cachix: installing');
|
core.startGroup('Cachix: installing');
|
||||||
yield exec.exec('bash', ['-c', installCommand]);
|
yield exec.exec('bash', ['-c', installCommand]);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// for private caches
|
// for managed signing key and private caches
|
||||||
if (authToken !== "") {
|
if (authToken !== "") {
|
||||||
yield exec.exec(cachixExecutable, ['authtoken', authToken]);
|
yield exec.exec(cachixExecutable, ['authtoken', authToken]);
|
||||||
}
|
}
|
||||||
|
|
@ -1070,10 +1070,10 @@ function setup() {
|
||||||
}
|
}
|
||||||
if (signingKey !== "") {
|
if (signingKey !== "") {
|
||||||
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
|
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
|
||||||
|
}
|
||||||
// Remember existing store paths
|
// Remember existing store paths
|
||||||
yield exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' > /tmp/store-path-pre-build`]);
|
yield exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' > /tmp/store-path-pre-build`]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`Action failed with error: ${error}`);
|
core.setFailed(`Action failed with error: ${error}`);
|
||||||
throw (error);
|
throw (error);
|
||||||
|
|
@ -1083,11 +1083,17 @@ function setup() {
|
||||||
function upload() {
|
function upload() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
if (signingKey !== "" && skipPush !== 'true') {
|
if (skipPush === 'true') {
|
||||||
|
core.info('Pushing is disabled as skipPush is set to true');
|
||||||
|
}
|
||||||
|
else if (signingKey !== "" || authToken !== "") {
|
||||||
core.startGroup('Cachix: pushing paths');
|
core.startGroup('Cachix: pushing paths');
|
||||||
child_process_1.execFileSync(`${__dirname}/push-paths.sh`, [cachixExecutable, name], { stdio: 'inherit' });
|
child_process_1.execFileSync(`${__dirname}/push-paths.sh`, [cachixExecutable, name], { stdio: 'inherit' });
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.info('Pushing is disabled as signing key nor auth token are set.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`Action failed with error: ${error}`);
|
core.setFailed(`Action failed with error: ${error}`);
|
||||||
|
|
|
||||||
10
src/main.ts
10
src/main.ts
|
|
@ -22,7 +22,7 @@ async function setup() {
|
||||||
await exec.exec('bash', ['-c', installCommand]);
|
await exec.exec('bash', ['-c', installCommand]);
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// for private caches
|
// for managed signing key and private caches
|
||||||
if (authToken !== "") {
|
if (authToken !== "") {
|
||||||
await exec.exec(cachixExecutable, ['authtoken', authToken]);
|
await exec.exec(cachixExecutable, ['authtoken', authToken]);
|
||||||
}
|
}
|
||||||
|
|
@ -43,9 +43,9 @@ async function setup() {
|
||||||
|
|
||||||
if (signingKey !== "") {
|
if (signingKey !== "") {
|
||||||
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
|
core.exportVariable('CACHIX_SIGNING_KEY', signingKey);
|
||||||
|
}
|
||||||
// Remember existing store paths
|
// Remember existing store paths
|
||||||
await exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' > /tmp/store-path-pre-build`]);
|
await exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' > /tmp/store-path-pre-build`]);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(`Action failed with error: ${error}`);
|
core.setFailed(`Action failed with error: ${error}`);
|
||||||
throw (error);
|
throw (error);
|
||||||
|
|
@ -54,10 +54,14 @@ async function setup() {
|
||||||
|
|
||||||
async function upload() {
|
async function upload() {
|
||||||
try {
|
try {
|
||||||
if (signingKey !== "" && skipPush !== 'true') {
|
if (skipPush === 'true') {
|
||||||
|
core.info('Pushing is disabled as skipPush is set to true');
|
||||||
|
} else if (signingKey !== "" || authToken !== "") {
|
||||||
core.startGroup('Cachix: pushing paths');
|
core.startGroup('Cachix: pushing paths');
|
||||||
execFileSync(`${__dirname}/push-paths.sh`, [cachixExecutable, name], { stdio: 'inherit' });
|
execFileSync(`${__dirname}/push-paths.sh`, [cachixExecutable, name], { stdio: 'inherit' });
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
|
} else {
|
||||||
|
core.info('Pushing is disabled as signing key nor auth token are set.');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(`Action failed with error: ${error}`);
|
core.setFailed(`Action failed with error: ${error}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue