From 114888726fa5229dd3cacc31ccfb00ec2a86b015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Postula?= Date: Mon, 22 Jul 2024 20:50:10 +0200 Subject: [PATCH] fix: cargo-rust-registry requires the package name --- src/commands/generate_workflow/mod.rs | 3 ++- .../generate_workflow/workflows/publish_rust_registry.rs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/commands/generate_workflow/mod.rs b/src/commands/generate_workflow/mod.rs index 47ddba4..c4603c6 100644 --- a/src/commands/generate_workflow/mod.rs +++ b/src/commands/generate_workflow/mod.rs @@ -62,7 +62,7 @@ pub struct Options { template: Option, #[arg(long, default_value_t = false)] no_depends_on_template_jobs: bool, - #[arg(long, default_value = "v3.0.0")] + #[arg(long, default_value = "v3.0.1")] build_workflow_version: String, #[arg(long)] fslabscli_version: Option, @@ -718,6 +718,7 @@ pub async fn generate_workflow( } if member.publish_detail.cargo.publish { member_workflows.push(Box::new(PublishRustRegistryWorkflow::new( + member_key.clone(), working_directory.clone(), &dynamic_value_base, ))); diff --git a/src/commands/generate_workflow/workflows/publish_rust_registry.rs b/src/commands/generate_workflow/workflows/publish_rust_registry.rs index 44810d0..ff9ee51 100644 --- a/src/commands/generate_workflow/workflows/publish_rust_registry.rs +++ b/src/commands/generate_workflow/workflows/publish_rust_registry.rs @@ -11,6 +11,8 @@ pub struct PublishRustRegistryWorkflowOutputs { #[derive(Default, Clone)] pub struct PublishRustRegistryWorkflowInputs { + /// Package name + pub package: String, /// Working directory to run the cargo command pub working_directory: String, /// Which toolchain to use @@ -29,6 +31,7 @@ pub struct PublishRustRegistryWorkflowInputs { impl From<&PublishRustRegistryWorkflowInputs> for IndexMap { fn from(val: &PublishRustRegistryWorkflowInputs) -> Self { let mut map: IndexMap = IndexMap::new(); + map.insert("package".to_string(), val.package.clone().into()); map.insert( "working_directory".to_string(), val.working_directory.clone().into(), @@ -61,9 +64,10 @@ pub struct PublishRustRegistryWorkflow { } impl PublishRustRegistryWorkflow { - pub fn new(working_directory: String, dynamic_value_base: &str) -> Self { + pub fn new(package: String, working_directory: String, dynamic_value_base: &str) -> Self { Self { inputs: PublishRustRegistryWorkflowInputs { + package, working_directory, toolchain: format!("${{{{ {}.{}) }}}}", dynamic_value_base, "toolchain"), additional_args: format!(