anodizer_core/config/publisher.rs
1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::{ExtraFileSpec, StringOrBool, TemplatedExtraFile, deserialize_string_or_bool_opt};
5
6// ---------------------------------------------------------------------------
7// PublisherConfig
8// ---------------------------------------------------------------------------
9
10#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
11#[serde(default, deny_unknown_fields)]
12pub struct PublisherConfig {
13 /// Human-readable name for this publisher (used in logs).
14 pub name: Option<String>,
15 /// Command to invoke for publishing.
16 pub cmd: String,
17 /// Arguments passed to the publish command (supports templates).
18 pub args: Option<Vec<String>>,
19 /// Build IDs filter: only publish artifacts from builds whose `id` is in this list.
20 pub ids: Option<Vec<String>>,
21 /// Artifact type filter: only publish artifacts of these types (e.g., "archive", "binary").
22 pub artifact_types: Option<Vec<String>>,
23 /// Environment variables passed to the publish command.
24 #[serde(default)]
25 pub env: Option<Vec<String>>,
26 /// Working directory for the publisher command.
27 pub dir: Option<String>,
28 /// Template-conditional skip: if rendered result is `"true"`, skip this publisher.
29 /// Accepts bool or template string (e.g. `"{{ if .IsSnapshot }}true{{ endif }}"`).
30 /// Accepts the legacy `disable:` spelling via serde alias for back-compat.
31 #[serde(
32 alias = "disable",
33 deserialize_with = "deserialize_string_or_bool_opt",
34 default
35 )]
36 pub skip: Option<StringOrBool>,
37 /// Include checksums in published artifacts.
38 pub checksum: Option<bool>,
39 /// Include signatures in published artifacts.
40 pub signature: Option<bool>,
41 /// Include `dist/metadata.json` in published artifacts. The sibling
42 /// `dist/artifacts.json` manifest is never published.
43 pub meta: Option<bool>,
44 /// Extra files to include in publishing (glob patterns with optional name override).
45 pub extra_files: Option<Vec<ExtraFileSpec>>,
46 /// Extra files whose contents are rendered through the template engine before publishing.
47 /// Unlike `extra_files` which copy as-is, template variables like `{{ Tag }}` are expanded.
48 pub templated_extra_files: Option<Vec<TemplatedExtraFile>>,
49 /// Template-conditional gate: when the rendered result is falsy
50 /// (`"false"` / `"0"` / `"no"` / empty), the publisher is skipped.
51 /// Render failure hard-errors. The
52 /// `customization/publishers/` `if:` field. Distinct from `skip:`
53 /// (which expresses "always skip") and provides config-import parity.
54 #[serde(rename = "if")]
55 pub if_condition: Option<String>,
56}