Skip to main content

PublishConfig

Enum PublishConfig 

Source
pub enum PublishConfig {
    Cargo {
        features: Vec<String>,
        registry: Option<String>,
        workspace: bool,
    },
    Npm {
        registry: Option<String>,
        access: Option<String>,
        workspace: bool,
    },
    Docker {
        image: String,
        platforms: Vec<String>,
        dockerfile: Option<String>,
    },
    Pypi {
        repository: Option<String>,
        workspace: bool,
    },
    Go,
    Custom {
        command: String,
        check: Option<String>,
        cwd: Option<String>,
    },
}
Expand description

Per-package publish configuration. Typed enum — the user picks a known publisher (cargo, npm, docker, pypi, go) and sr handles both the “is it already published?” check (registry API call) and the actual publish command (shelled out). The custom variant is the escape hatch for arbitrary shell commands + a user-supplied state check.

Deserializes as an internally-tagged enum: { type: <publisher>, ... }.

Variants§

§

Cargo

cargo publish to crates.io (or a custom registry).

Fields

§features: Vec<String>

Feature flags forwarded to cargo publish --features ....

§registry: Option<String>

Cargo registry name (defined in ~/.cargo/config.toml). None = default registry (crates.io).

§workspace: bool

When true, publish every [workspace].members crate, not just the one at path. Check aggregates across members (completed iff every member is already on the registry).

§

Npm

npm publish to registry.npmjs.org (or a custom registry). Auto-detects pnpm / yarn / npm from lockfiles at path.

Fields

§registry: Option<String>

Registry URL. None = default (https://registry.npmjs.org/).

§access: Option<String>

Access level for scoped packages: “public” or “restricted”.

§workspace: bool

When true, publish every workspace member (from package.json workspaces or pnpm-workspace.yaml). Uses the tool’s native recursive publish where available.

§

Docker

Push a container image to a registry using docker buildx build --push.

Fields

§image: String

Fully-qualified image name (e.g. ghcr.io/owner/repo).

§platforms: Vec<String>

Target platforms for buildx (e.g. ["linux/amd64", "linux/arm64"]). When empty, buildx picks the default.

§dockerfile: Option<String>

Path to Dockerfile relative to the package dir. Default: Dockerfile.

§

Pypi

Publish to PyPI via twine upload or uv publish (auto-detected).

Fields

§repository: Option<String>

Repository name (matches [tool.twine.repository] or env).

§workspace: bool

When true, publish every uv workspace member ([tool.uv.workspace].members). Check aggregates across members.

§

Go

Go modules publish by git-tag; sr already cuts the tag, so this is effectively a noop documenting the package’s presence in the manifest.

§

Custom

Arbitrary publish command with a user-supplied state check. The only place sr shells out for a user-provided command; limited to registries that don’t have a built-in publisher.

Fields

§command: String

Shell command that performs the publish.

§check: Option<String>

Shell command that returns exit 0 iff the package is already published at the current version. Optional — when absent, the publisher always runs.

§cwd: Option<String>

Working directory. Defaults to the package path.

Trait Implementations§

Source§

impl Clone for PublishConfig

Source§

fn clone(&self) -> PublishConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PublishConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PublishConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for PublishConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,