Publish Rust Packages
Suppose you want to publish a crate package to the newly created sparse registry using:
Publish packages using Cargo command-line tool
Configure connection to the Cargo registry. The instructions are different for a local Cargo registry and for a mirror of a remote registry (the most common case is mirroring crates.io):
In your Rust project, add the
config.toml
file to the.cargo
directory.Add the registry data to the
config.toml
file. For example:[registries.space-registry] index = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates" credential-provider="cargo:token"If you are not sure about the URL, you can copy the URL of a particular container registry on the Packages page.
Log in to the registry:
cargo login --registry=space-registryHere
space-registry
is the registry name you specified inconfig.toml
.When asked for credentials, specify either your Space username and password (we recommend that you use a personal token instead) or a client ID and a client secret of a service account.
In your Rust project, add the
config.toml
file to the.cargo
directory.Add the registry data to the
config.toml
file. For example:[registries.space-registry-mirror] index = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates-mirror" credential-provider="cargo:token"If you are not sure about the URL, you can copy the URL of a particular container registry on the Packages page.
Log in to the registry:
cargo login --registry=space-registry-mirrorHere
space-registry-mirror
is the registry name you specified inconfig.toml
.When asked for credentials, specify either your Space username and password (we recommend that you use a personal token instead) or a client ID and a client secret of a service account.
Open the
config.toml
and configure registry replacing by adding the lines:[source] space-registry-mirror = { registry = "sparse+https://cargo.registry.jetbrains.space/mycompany/p/projectkey/myCrates-mirror" } crates-io = { replace-with = "space-registry-mirror" }
Publish the package to the registry:
cargo publish --registry=space-registry
Publish packages from Space Automation
For the instructions on how to publish Rust packages from Space Automation, refer to Space Automation examples.