anodizer_core/config/publishers/winget.rs
1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use super::super::{PostPublishPollConfig, StringOrBool, deserialize_string_or_bool_opt};
5use super::{CommitAuthorConfig, RepositoryConfig};
6
7// ---------------------------------------------------------------------------
8// WingetConfig
9// ---------------------------------------------------------------------------
10
11#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
12#[serde(default, deny_unknown_fields)]
13pub struct WingetConfig {
14 /// Override the package name (default: crate name).
15 pub name: Option<String>,
16 /// Package name as displayed (default: same as name).
17 pub package_name: Option<String>,
18 /// WinGet package identifier (e.g. "Publisher.AppName"). Auto-generated if empty.
19 pub package_identifier: Option<String>,
20 /// Publisher name (required).
21 pub publisher: Option<String>,
22 /// Publisher homepage URL shown in the WinGet manifest.
23 pub publisher_url: Option<String>,
24 /// Publisher support URL.
25 pub publisher_support_url: Option<String>,
26 /// Privacy policy URL.
27 pub privacy_url: Option<String>,
28 /// Author name.
29 pub author: Option<String>,
30 /// Copyright notice.
31 pub copyright: Option<String>,
32 /// Copyright URL.
33 pub copyright_url: Option<String>,
34 /// License identifier (required, e.g. "MIT").
35 pub license: Option<String>,
36 /// License URL.
37 pub license_url: Option<String>,
38 /// Short description (required, max 256 chars).
39 pub short_description: Option<String>,
40 /// Full package description displayed in the WinGet gallery.
41 pub description: Option<String>,
42 /// Project homepage URL.
43 pub homepage: Option<String>,
44 /// Custom URL template for download URLs (overrides release URL).
45 pub url_template: Option<String>,
46 /// Build IDs filter: only include artifacts whose `id` is in this list.
47 pub ids: Option<Vec<String>>,
48 /// Skip publishing. `"true"` always skips; `"auto"` skips for prereleases.
49 /// Accepts bool or template string.
50 #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
51 pub skip_upload: Option<StringOrBool>,
52 /// Custom commit message template.
53 pub commit_msg_template: Option<String>,
54 /// Manifest file path (auto-generated if empty from publisher/name/version).
55 pub path: Option<String>,
56 /// Release notes for this version.
57 pub release_notes: Option<String>,
58 /// URL to full release notes.
59 pub release_notes_url: Option<String>,
60 /// Post-install notes shown to the user.
61 pub installation_notes: Option<String>,
62 /// Tags for package discovery (lowercased, spaces→hyphens).
63 pub tags: Option<Vec<String>>,
64 /// Package dependencies.
65 pub dependencies: Option<Vec<WingetDependency>>,
66 /// Unified repository config with branch, token, PR, git SSH support.
67 /// (Replaces the legacy `manifests_repo: WingetManifestsRepoConfig`.)
68 pub repository: Option<RepositoryConfig>,
69 /// Commit author with optional signing.
70 pub commit_author: Option<CommitAuthorConfig>,
71 /// Product code for the installer (used in Add/Remove Programs).
72 pub product_code: Option<String>,
73 /// Artifact selection: "archive" (default), "msi", or "nsis".
74 #[serde(rename = "use")]
75 pub use_artifact: Option<String>,
76 /// amd64 microarchitecture variant filter (e.g. "v1", "v2", "v3", "v4").
77 /// Only artifacts matching this variant are included. Default: "v1".
78 pub amd64_variant: Option<String>,
79 /// Post-publish PR-validation polling settings. When unset, polling runs
80 /// with defaults (enabled, 30s interval, 30m timeout). Polling can be
81 /// disabled globally via `--no-post-publish-poll`.
82 pub post_publish_poll: Option<PostPublishPollConfig>,
83 /// When true, force-push the updated manifest to the existing PR branch
84 /// when a PR for the same head branch already exists. The PR content is
85 /// updated in place rather than creating a duplicate. When false (default),
86 /// the push is skipped and a warning is emitted so the operator sees that
87 /// the publisher did not update the PR.
88 #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
89 pub update_existing_pr: Option<StringOrBool>,
90}
91
92/// WinGet package dependency.
93#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
94#[serde(default)]
95pub struct WingetDependency {
96 /// WinGet package identifier of the dependency (e.g., "Publisher.App").
97 pub package_identifier: String,
98 /// Minimum required version of the dependency.
99 pub minimum_version: Option<String>,
100}