Skip to content

Commit

Permalink
fix: Allow dirty workspace in dry-run publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Apr 4, 2024
1 parent 5e4e0a4 commit 34d7c7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions dist/publish-crates-cargo-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82401,7 +82401,7 @@ async function publishToEstuary(input, repo, registry, registryDepsRegExp, branc
CARGO_REGISTRY_DEFAULT: registry.name,
[`CARGO_REGISTRIES_${registry.name.toUpperCase()}_TOKEN`]: registry.token,
};
publish(path, env);
publish(path, env, true);
}
function publishToCratesIo(input, repo, branch) {
clone(input, repo, branch);
Expand All @@ -82411,15 +82411,19 @@ function publishToCratesIo(input, repo, branch) {
};
publish(path, env);
}
function publish(path, env) {
function publish(path, env, allowDirty = false) {
const options = {
env,
cwd: path,
check: true,
};
for (const package_ of packagesOrdered(path)) {
if (package_.publish == undefined || package_.publish) {
command_sh(`cargo publish --manifest-path ${package_.manifestPath}`, options);
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
}
command_sh(command.join(" "), options);
}
}
command_sh("cargo clean", options);
Expand Down
10 changes: 7 additions & 3 deletions src/publish-crates-cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function publishToEstuary(
[`CARGO_REGISTRIES_${registry.name.toUpperCase()}_TOKEN`]: registry.token,
};

publish(path, env);
publish(path, env, true);
}

function publishToCratesIo(input: Input, repo: string, branch?: string) {
Expand All @@ -136,7 +136,7 @@ function publishToCratesIo(input: Input, repo: string, branch?: string) {
publish(path, env);
}

function publish(path: string, env: NodeJS.ProcessEnv) {
function publish(path: string, env: NodeJS.ProcessEnv, allowDirty: boolean = false) {
const options = {
env,
cwd: path,
Expand All @@ -145,7 +145,11 @@ function publish(path: string, env: NodeJS.ProcessEnv) {

for (const package_ of cargo.packagesOrdered(path)) {
if (package_.publish == undefined || package_.publish) {
sh(`cargo publish --manifest-path ${package_.manifestPath}`, options);
const command = ["cargo", "publish", "--manifest-path", package_.manifestPath];
if (allowDirty) {
command.push("--allow-dirty");
}
sh(command.join(" "), options);
}
}

Expand Down

0 comments on commit 34d7c7e

Please sign in to comment.