Skip to content

Commit 6429eff

Browse files
committed
fix(publish): workspace included license file had incorrect path (#24747)
Also fixes the issue where we say a package was successfully published before it wasn't. Bug in #24714
1 parent ecaf922 commit 6429eff

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

cli/tools/registry/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ impl PublishPreparer {
473473
publish_paths.push(CollectedPublishPath {
474474
specifier: ModuleSpecifier::from_file_path(&license_path)
475475
.unwrap(),
476-
relative_path: "LICENSE".to_string(),
476+
relative_path: "/LICENSE".to_string(),
477477
maybe_content: Some(std::fs::read(&license_path).with_context(
478478
|| format!("failed reading '{}'.", license_path.display()),
479479
)?),
@@ -1014,14 +1014,6 @@ async fn publish_package(
10141014
);
10151015
}
10161016

1017-
log::info!(
1018-
"{} @{}/{}@{}",
1019-
colors::green("Successfully published"),
1020-
package.scope,
1021-
package.package,
1022-
package.version
1023-
);
1024-
10251017
let enable_provenance = std::env::var("DISABLE_JSR_PROVENANCE").is_err()
10261018
&& (auth::is_gha() && auth::gha_oidc_token().is_some() && provenance);
10271019

@@ -1071,6 +1063,14 @@ async fn publish_package(
10711063
.await?;
10721064
}
10731065

1066+
log::info!(
1067+
"{} @{}/{}@{}",
1068+
colors::green("Successfully published"),
1069+
package.scope,
1070+
package.package,
1071+
package.version
1072+
);
1073+
10741074
log::info!(
10751075
"{}",
10761076
colors::gray(format!(

cli/tools/registry/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub enum PackagePathValidationError {
214214
pub struct CollectedPublishPath {
215215
pub specifier: ModuleSpecifier,
216216
pub path: PathBuf,
217-
/// Relative path to use in the tarball.
217+
/// Relative path to use in the tarball. This should be prefixed with a `/`.
218218
pub relative_path: String,
219219
/// Specify the contents for any injected paths.
220220
pub maybe_content: Option<Vec<u8>>,

cli/tools/registry/tar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub fn create_gzipped_tarball(
6464
hash: format!("sha256-{:x}", sha2::Sha256::digest(&content)),
6565
size: content.len(),
6666
});
67+
assert!(path_str.starts_with('/'));
6768
tar
6869
.add_file(format!(".{}", path_str), &content)
6970
.with_context(|| {

tests/testdata/publish/successful_provenance.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Check file:///[WILDCARD]/publish/successful/mod.ts
22
Checking for slow types in the public API...
33
Check file:///[WILDCARD]/publish/successful/mod.ts
44
Publishing @foo/[email protected] ...
5-
Successfully published @foo/[email protected]
65
Provenance transparency log available at https://search.sigstore.dev/?logIndex=42069
6+
Successfully published @foo/[email protected]
77
Visit http://127.0.0.1:4250/@foo/[email protected] for details

0 commit comments

Comments
 (0)