anodizer_core/config/upload.rs
1use std::collections::HashMap;
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6use super::{ExtraFileSpec, StringOrBool, deserialize_string_or_bool_opt};
7
8// ---------------------------------------------------------------------------
9// UploadConfig (generic HTTP upload)
10// ---------------------------------------------------------------------------
11
12#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
13#[serde(default)]
14pub struct UploadConfig {
15 /// Human-readable name for this upload config.
16 pub name: Option<String>,
17 /// Build IDs filter: only upload artifacts whose `id` is in this list.
18 pub ids: Option<Vec<String>>,
19 /// File extension filter: only upload artifacts with these extensions.
20 pub exts: Option<Vec<String>>,
21 /// Target URL template (supports template variables like {{ .ProjectName }}, {{ .Version }}).
22 pub target: String,
23 /// Username for HTTP basic auth.
24 /// Resolution order: rendered `username` template → env `UPLOAD_{NAME}_USERNAME`.
25 /// Set this to a literal value or a `{{ .Env.X }}` template.
26 pub username: Option<String>,
27 /// Password for HTTP basic auth.
28 ///
29 /// Strongly prefer `{{ .Env.UPLOAD_PASSWORD }}` (or any other env-var
30 /// template) over an in-config literal — plaintext values here are NOT
31 /// redacted from dry-run output and will land in `dist/config.yaml`
32 /// when the pipeline runs with `--dry-run` / `--snapshot`. Resolution
33 /// order: rendered `password` template → env `UPLOAD_{NAME}_SECRET`.
34 /// Mirrors GoReleaser's `Upload.Password` cascade.
35 pub password: Option<String>,
36 /// HTTP method: PUT or POST (default: PUT).
37 pub method: Option<String>,
38 /// Upload mode: "archive" (default) or "binary".
39 pub mode: Option<String>,
40 /// Header name for the SHA256 checksum of the artifact.
41 pub checksum_header: Option<String>,
42 /// Path to PEM-encoded trusted CA certificates.
43 pub trusted_certificates: Option<String>,
44 /// Path to PEM-encoded client X.509 certificate for mTLS.
45 pub client_x509_cert: Option<String>,
46 /// Path to PEM-encoded client X.509 key for mTLS.
47 pub client_x509_key: Option<String>,
48 /// Include checksums in uploaded artifacts.
49 pub checksum: Option<bool>,
50 /// Include signatures in uploaded artifacts.
51 pub signature: Option<bool>,
52 /// Include metadata artifacts in uploaded artifacts.
53 pub meta: Option<bool>,
54 /// Custom HTTP headers (each value is template-expanded).
55 pub custom_headers: Option<HashMap<String, String>>,
56 /// When true, use the artifact name as-is (don't append to target URL).
57 pub custom_artifact_name: Option<bool>,
58 /// Extra files to include in uploading.
59 pub extra_files: Option<Vec<ExtraFileSpec>>,
60 /// Upload only extra files, skip normal artifacts.
61 pub extra_files_only: Option<bool>,
62 /// Skip condition template (if rendered to "true", skip this upload).
63 #[serde(deserialize_with = "deserialize_string_or_bool_opt", default)]
64 pub skip: Option<StringOrBool>,
65}