Skip to content

Commit

Permalink
Skip prep steps if using pathsToPush
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Apr 25, 2024
1 parent fb5cb83 commit dd02553
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 10 additions & 1 deletion dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7754,6 +7754,8 @@ var PushMode;
(function (PushMode) {
// Disable pushing entirely.
PushMode["None"] = "None";
// Push paths provided via the `pathsToPush` input.
PushMode["PushPaths"] = "PushPaths";
// Scans the entire store during the pre- and post-hooks and uploads the difference.
// This is a very simple method and is likely to work in any environment.
// There are two downsides:
Expand Down Expand Up @@ -7821,7 +7823,10 @@ async function setup() {
// Determine the push mode to use
let pushMode = PushMode.None;
if (hasPushTokens && !skipPush) {
if (useDaemon) {
if (pathsToPush) {
pushMode = PushMode.PushPaths;
}
else if (useDaemon) {
let supportsDaemonInterface = (cachixVersion) ? semver_1.default.gte(cachixVersion, '1.7.0') : false;
let supportsPostBuildHook = await isTrustedUser();
if (!supportsDaemonInterface) {
Expand Down Expand Up @@ -7895,6 +7900,10 @@ async function upload() {
}
break;
}
case PushMode.PushPaths: {
await exec.exec(`${__dirname}/push-paths.sh`, [cachixBin, cachixArgs, name, pathsToPush, pushFilter]);
break;
}
case PushMode.Daemon: {
const daemonDir = process.env[ENV_CACHIX_DAEMON_DIR];
if (!daemonDir) {
Expand Down
13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const ENV_CACHIX_DAEMON_DIR = 'CACHIX_DAEMON_DIR';
enum PushMode {
// Disable pushing entirely.
None = 'None',
// Push paths provided via the `pathsToPush` input.
PushPaths = 'PushPaths',
// Scans the entire store during the pre- and post-hooks and uploads the difference.
// This is a very simple method and is likely to work in any environment.
// There are two downsides:
Expand Down Expand Up @@ -107,7 +109,9 @@ async function setup() {
let pushMode = PushMode.None;

if (hasPushTokens && !skipPush) {
if (useDaemon) {
if (pathsToPush) {
pushMode = PushMode.PushPaths;
} else if (useDaemon) {
let supportsDaemonInterface = (cachixVersion) ? semver.gte(cachixVersion, '1.7.0') : false;
let supportsPostBuildHook = await isTrustedUser();

Expand Down Expand Up @@ -169,6 +173,7 @@ async function setup() {

break;
}

case PushMode.StoreScan: {
// Remember existing store paths
await exec.exec("sh", ["-c", `${__dirname}/list-nix-store.sh > /tmp/store-path-pre-build`]);
Expand Down Expand Up @@ -200,6 +205,12 @@ async function upload() {

break;
}

case PushMode.PushPaths: {
await exec.exec(`${__dirname}/push-paths.sh`, [cachixBin, cachixArgs, name, pathsToPush, pushFilter]);
break;
}

case PushMode.Daemon: {
const daemonDir = process.env[ENV_CACHIX_DAEMON_DIR];

Expand Down

0 comments on commit dd02553

Please sign in to comment.