pub struct StructuredHook {
pub cmd: String,
pub dir: Option<String>,
pub env: Option<Vec<String>>,
pub output: Option<bool>,
pub if_condition: Option<String>,
pub ids: Option<Vec<String>>,
pub artifacts: Option<BeforePublishArtifactFilter>,
pub run_once: bool,
}Fields§
§cmd: StringCommand to run.
The entire string is interpreted by sh -c, so shell metacharacters
(|, ;, &&, backticks, $(), redirects, globs) are honoured —
any templated values folded into cmd become part of the shell
command and are subject to word-splitting and metacharacter expansion.
Keep templated user-config values out of cmd when possible, or quote
them defensively (e.g. '{{ Env.FOO }}'). Hooks already run with
env_clear() plus an allow-list, so secrets in $ENV are not
inherited unless explicitly listed in env.
dir: Option<String>Working directory for the command (defaults to project root).
env: Option<Vec<String>>Environment variables for the command.
output: Option<bool>When true, capture and log stdout/stderr of the command.
if_condition: Option<String>Template-conditional: when set, the hook only runs if the rendered
result is truthy (not "false" / "0" / "no" / empty). Render
failure hard-errors (not silent-skip).
before.hooks[].if: / per-build / per-archive hook if: surface.
ids: Option<Vec<String>>Artifact-id allow-list (before_publish: only). When Some, the
per-artifact iteration only fires for artifacts whose
metadata["id"] matches one of these strings. None (the default)
imposes no id constraint. Ignored by lifecycle hook sites
(before: / after: / per-build / per-archive) — those run once
per pipeline tick, not per artifact.
artifacts: Option<BeforePublishArtifactFilter>Artifact-kind filter (before_publish: only). When Some, the
per-artifact iteration only fires for artifacts whose
ArtifactKind matches the filter. None is equivalent to
BeforePublishArtifactFilter::All (every registered artifact).
Ignored by lifecycle hook sites for the same reason as ids.
run_once: boolRun the hook exactly once before the publish stage instead of once
per matching artifact (before_publish: only). With the default
false, the hook keeps the per-artifact semantics: it fires once for
each artifact passing the ids / artifacts filters, with the
per-artifact template vars (ArtifactName, ArtifactPath, …) and
the $ANODIZER_ARTIFACT channel bound. With true, the hook runs a
single time with the run-level template vars (Version, Tag, …);
the ids / artifacts filters and the per-artifact vars do not apply,
so the command is expected to iterate the dist directory itself. A
Rust-additive extension with no GoReleaser counterpart.
Trait Implementations§
Source§impl Clone for StructuredHook
impl Clone for StructuredHook
Source§fn clone(&self) -> StructuredHook
fn clone(&self) -> StructuredHook
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructuredHook
impl Debug for StructuredHook
Source§impl Default for StructuredHook
impl Default for StructuredHook
Source§fn default() -> StructuredHook
fn default() -> StructuredHook
Source§impl<'de> Deserialize<'de> for StructuredHookwhere
StructuredHook: Default,
impl<'de> Deserialize<'de> for StructuredHookwhere
StructuredHook: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for StructuredHook
impl JsonSchema for StructuredHook
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more