Skip to content

Commit

Permalink
Merge pull request #1352 from hannobraun/release
Browse files Browse the repository at this point in the history
Re-trigger release v0.24.0
  • Loading branch information
hannobraun authored Nov 14, 2022
2 parents a53e701 + 740e3f8 commit 0b40c16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 7 additions & 3 deletions tools/release-operator/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ pub struct Actions;

impl Actions {
// Set an "output" in GitHub Actions
pub fn set_output(key: Outputs, value: &str) -> anyhow::Result<()> {
pub fn set_output<'r>(
outputs: impl IntoIterator<Item = (Outputs, &'r str)>,
) -> anyhow::Result<()> {
const GITHUB_OUTPUT: &str = "GITHUB_OUTPUT";

let output = env::var_os(GITHUB_OUTPUT).ok_or_else(|| {
anyhow!("Could not read environment variable {GITHUB_OUTPUT}")
})?;
let mut output = File::options().append(true).open(output)?;

log::debug!("setting output name={key} value={value}");
writeln!(output, "{key}={value}")?;
for (key, value) in outputs {
log::debug!("setting output name={key} value={value}");
writeln!(output, "{key}={value}")?;
}

Ok(())
}
Expand Down
8 changes: 5 additions & 3 deletions tools/release-operator/src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ impl Release {
let tag = format!("v{tag}");
log::info!("detected release of {tag}");

Actions::set_output(Outputs::ReleaseDetected, "true")?;
Actions::set_output(Outputs::TagName, &tag)?;
Actions::set_output([
(Outputs::ReleaseDetected, "true"),
(Outputs::TagName, &tag),
])?;

Ok(())
}

fn miss(&self) -> anyhow::Result<()> {
log::info!("no release detected");
Actions::set_output(Outputs::ReleaseDetected, "false")?;
Actions::set_output([(Outputs::ReleaseDetected, "false")])?;
Ok(())
}
}

0 comments on commit 0b40c16

Please sign in to comment.