Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-trigger release v0.24.0 #1352

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(())
}
}