Skip to main content

anodizer_core/config/publishers/
aur.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::super::{StringOrBool, deserialize_string_or_bool_opt};
5use super::CommitAuthorConfig;
6
7// ---------------------------------------------------------------------------
8// AurConfig
9// ---------------------------------------------------------------------------
10
11#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
12#[serde(default, deny_unknown_fields)]
13pub struct AurConfig {
14    /// Override the package name (default: crate name + "-bin").
15    pub name: Option<String>,
16    /// Build IDs filter: only include artifacts whose `id` is in this list.
17    pub ids: Option<Vec<String>>,
18    /// Commit author with optional signing.
19    pub commit_author: Option<CommitAuthorConfig>,
20    /// Custom commit message template. Default: "Update to {{ version }}".
21    pub commit_msg_template: Option<String>,
22    /// Short description of the package for PKGBUILD.
23    pub description: Option<String>,
24    /// Project homepage URL.
25    pub homepage: Option<String>,
26    /// SPDX license identifier (e.g., "MIT", "Apache-2.0").
27    pub license: Option<String>,
28    /// Skip publishing. `"true"` always skips; `"auto"` skips for prereleases.
29    /// Accepts bool or template string.
30    #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
31    pub skip_upload: Option<StringOrBool>,
32    /// Custom URL template for download URLs (overrides release URL).
33    pub url_template: Option<String>,
34    /// PKGBUILD maintainer entries (e.g., "Name <email@example.com>").
35    pub maintainers: Option<Vec<String>>,
36    /// Contributors listed in PKGBUILD comments.
37    pub contributors: Option<Vec<String>>,
38    /// Packages this PKGBUILD provides (virtual package names).
39    pub provides: Option<Vec<String>>,
40    /// Packages this PKGBUILD conflicts with.
41    pub conflicts: Option<Vec<String>>,
42    /// Runtime dependencies required by this package.
43    pub depends: Option<Vec<String>>,
44    /// Optional dependencies with descriptions (e.g., "fzf: fuzzy finder support").
45    pub optdepends: Option<Vec<String>>,
46    /// List of config files to preserve on upgrade (relative to `/`).
47    pub backup: Option<Vec<String>>,
48    /// Package release number (default: "1").
49    pub rel: Option<String>,
50    /// Custom PKGBUILD `package()` function body.
51    pub package: Option<String>,
52    /// AUR SSH git URL override. Defaults to
53    /// `ssh://aur@aur.archlinux.org/<package>.git`, derived from the resolved
54    /// package name; set this only for a non-standard endpoint.
55    pub git_url: Option<String>,
56    /// Custom SSH command for git operations.
57    pub git_ssh_command: Option<String>,
58    /// Path to SSH private key file.
59    pub private_key: Option<String>,
60    /// Subdirectory in the git repo for committed files.
61    pub directory: Option<String>,
62    /// Skip this AUR config. Accepts bool or template string
63    /// (e.g. `"{{ if .IsSnapshot }}true{{ endif }}"` for conditional skip).
64    /// Accepts the legacy `disable:` spelling via serde alias for back-compat.
65    #[serde(
66        alias = "disable",
67        deserialize_with = "deserialize_string_or_bool_opt",
68        default
69    )]
70    pub skip: Option<StringOrBool>,
71    /// Content for a .install file (post-install/pre-remove scripts).
72    pub install: Option<String>,
73    // The PKGBUILD `url=` line resolves through `homepage:` →
74    // crate metadata `homepage` → derived
75    // `https://github.com/{release.github.owner}/{release.github.name}`.
76    /// Packages this PKGBUILD replaces (for upgrade paths from old package names).
77    pub replaces: Option<Vec<String>>,
78    /// amd64 microarchitecture variant filter (e.g. "v1", "v2", "v3", "v4").
79    /// Only artifacts matching this variant are included. Default: "v1".
80    pub amd64_variant: Option<String>,
81    /// Override whether this publisher failing should fail the overall release.
82    ///
83    /// Default: `false` — a failure here is logged but does not abort the release.
84    /// Set to `true` to fail the release on any error.
85    #[serde(default, skip_serializing_if = "Option::is_none")]
86    pub required: Option<bool>,
87    /// Template-conditional gate: when the rendered result is falsy
88    /// (`"false"` / `"0"` / `"no"` / empty), the AUR publisher is skipped.
89    /// Render failure hard-errors. The `aurs[].if:` conditional gate.
90    #[serde(rename = "if")]
91    pub if_condition: Option<String>,
92    /// When `true`, a triggered rollback leaves this publisher's work in
93    /// place rather than attempting to undo it. Default `false`.
94    pub retain_on_rollback: Option<bool>,
95}