Skip to main content

anodizer_core/config/
workspace.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::{
5    ChangelogConfig, CrateConfig, HooksConfig, SignConfig, deserialize_binary_signs,
6    deserialize_signs, signs_schema,
7};
8
9// ---------------------------------------------------------------------------
10// WorkspaceConfig
11// ---------------------------------------------------------------------------
12
13/// A workspace represents an independent project root within a monorepo.
14/// Each workspace has its own crates, changelog, and release configuration,
15/// allowing independently-versioned components that aren't Cargo workspace members.
16#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema)]
17#[serde(default, deny_unknown_fields)]
18pub struct WorkspaceConfig {
19    /// Workspace identifier used in logs and template variables.
20    pub name: String,
21    /// Crates belonging to this workspace.
22    pub crates: Vec<CrateConfig>,
23    /// Changelog configuration for this workspace.
24    pub changelog: Option<ChangelogConfig>,
25    /// Signing configurations for binaries, archives, and checksums.
26    #[serde(default, deserialize_with = "deserialize_signs")]
27    #[schemars(schema_with = "signs_schema")]
28    pub signs: Vec<SignConfig>,
29    /// Binary-specific signing configs (same shape as `signs` but only for
30    /// binary artifacts). The `artifacts` field on each entry is constrained
31    /// at parse time to `binary` / `none` (or omitted) — a broader filter on
32    /// `binary_signs` would silently match nothing because the loop only
33    /// iterates Binary artifacts. Constraint lives in `deserialize_binary_signs`.
34    #[serde(default, deserialize_with = "deserialize_binary_signs")]
35    #[schemars(schema_with = "signs_schema")]
36    pub binary_signs: Vec<SignConfig>,
37    /// Hooks run before this workspace's pipeline starts.
38    pub before: Option<HooksConfig>,
39    /// Hooks run after this workspace's pipeline completes.
40    pub after: Option<HooksConfig>,
41    /// Environment variables scoped to this workspace.
42    ///
43    /// List of `KEY=VALUE` strings. Order is preserved.
44    /// Values are template-rendered at pipeline startup.
45    #[serde(default)]
46    pub env: Option<Vec<String>>,
47    /// Pipeline stages to skip when releasing this workspace.
48    /// Stage names match the CLI `--skip` flag (e.g., `announce`, `publish`).
49    #[serde(default)]
50    pub skip: Vec<String>,
51}