Skip to main content

anodizer_core/config/
monorepo.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4// ---------------------------------------------------------------------------
5// MonorepoConfig
6// ---------------------------------------------------------------------------
7
8/// GoReleaser Pro monorepo configuration.
9///
10/// When configured, tag discovery filters by `tag_prefix` and the working
11/// directory is scoped to `dir`.
12///
13/// This is DIFFERENT from `TagConfig.tag_prefix`:
14/// - `MonorepoConfig.tag_prefix`: tags in git already HAVE the prefix
15///   (e.g. `subproject1/v1.2.3`). The prefix is STRIPPED for `{{ .Tag }}`
16///   while `{{ .PrefixedTag }}` retains the full tag.
17/// - `TagConfig.tag_prefix`: a prefix to PREPEND when constructing
18///   `{{ .PrefixedTag }}` from a plain tag.
19///
20/// When `monorepo` is configured, it takes precedence over `tag.tag_prefix`
21/// for `PrefixedTag` / `PrefixedPreviousTag` behavior.
22#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
23#[serde(default, deny_unknown_fields)]
24pub struct MonorepoConfig {
25    /// Tag prefix for this subproject (e.g. `"subproject1/"`).
26    ///
27    /// Tags matching this prefix are selected during tag discovery, and the
28    /// prefix is stripped from `{{ .Tag }}` while `{{ .PrefixedTag }}` retains
29    /// the full tag.
30    pub tag_prefix: Option<String>,
31    /// Working directory for this subproject.
32    ///
33    /// Used for changelog path filtering (when no explicit `changelog.paths`
34    /// or `crate.path` is configured) and as the default build `dir`.
35    pub dir: Option<String>,
36}