Skip to main content

publish_execute

Function publish_execute 

Source
pub fn publish_execute(
    ledger_path: &Path,
    repo_path: &Path,
    token: Option<&str>,
    backoff_config: &BackoffConfig,
    crate_seq_version: &str,
    snapshot_store: Option<PathBuf>,
) -> Result<PublishReport, Error>
Expand description

Live publish: for each pending version, check idempotency, checkout, rewrite, package, publish, update ledger.

snapshot_store overrides the default .crate-seq-snapshots/ directory for entries with source = snapshot. Git-tag entries ignore snapshot_store.

Performs a pre-flight token check before any version is processed. If the ledger configures a token source (env var or command) and it fails, returns an actionable error immediately. If no token source is configured and cargo credentials are absent, passes None and lets cargo decide.

On success for each version: marks Published and saves ledger immediately (crash-safe — ledger reflects exact progress). On first failure: saves current ledger state and returns the partial report.

§Errors

Returns Error::TokenResolution on pre-flight token failure, Error::Ledger on ledger I/O failure, Error::Git on checkout failure, Error::SnapshotNotFound if a snapshot tarball is missing, Error::Manifest on rewrite failure, Error::Registry on registry HTTP failure, or Error::Subprocess if cargo cannot be spawned.