anodizer_core/config/templatefiles.rs
1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::{StringOrBool, deserialize_string_or_bool_opt};
5
6// ---------------------------------------------------------------------------
7// TemplateFileConfig
8// ---------------------------------------------------------------------------
9
10/// Configuration for a template file that is rendered through the template
11/// engine and placed in the dist directory as a release artifact.
12///
13/// All rendered template files are uploaded to the
14/// release by default. Both `src` and `dst` paths support template rendering.
15#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
16#[serde(default, deny_unknown_fields)]
17pub struct TemplateFileConfig {
18 /// Identifier for this template file entry (default: "default").
19 pub id: Option<String>,
20 /// Source template file path. The file contents are rendered through the template engine.
21 /// Templates: allowed (in path itself).
22 pub src: String,
23 /// Destination filename, prefixed with the dist directory.
24 /// Templates: allowed.
25 pub dst: String,
26 /// File permissions in octal notation as a string, e.g. `"0755"` (default: `"0655"`).
27 /// Parsed at runtime via `parse_octal_mode()` to avoid YAML interpreting as decimal.
28 pub mode: Option<String>,
29 /// Skip this entry when truthy. Accepts a literal bool or a Tera
30 /// template that renders to `"true"`/`"false"` (e.g.
31 /// `'{{ if eq .Os "windows" }}true{{ end }}'`). Mirrors the
32 /// per-entry `skip:` pattern used by `ChangelogConfig`,
33 /// `ChecksumConfig`, and the publishers.
34 #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
35 pub skip: Option<StringOrBool>,
36}