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

Expand and clean up release automation #1482

Merged
merged 3 commits into from
Jan 5, 2023
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
14 changes: 9 additions & 5 deletions tools/automator/src/announcement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn create_release_announcement(
let now = Utc::now();

let year = now.year();
let week = now.iso_week().week();
let week = format!("{:02}", now.iso_week().week());
let date = format!("{year}-{:02}-{:02}", now.month(), now.day());

let pull_requests_since_last_release =
Expand All @@ -42,9 +42,9 @@ pub async fn create_release_announcement(
.await?
.as_markdown(min_dollars, for_readme)?;

let mut file = create_file(year, week).await?;
let mut file = create_file(year, &week).await?;
generate_announcement(
week,
&week,
date,
version.to_string(),
sponsors,
Expand All @@ -56,11 +56,15 @@ pub async fn create_release_announcement(
Ok(())
}

async fn create_file(year: i32, week: u32) -> anyhow::Result<File> {
async fn create_file(year: i32, week: &str) -> anyhow::Result<File> {
let dir =
PathBuf::from(format!("content/blog/weekly-release/{year}-w{week}"));
let file = dir.join("index.md");

// VS Code (and probably other editors/IDEs) renders the path in the output
// as a clickable link, so the user can open the file easily.
println!("Generating release announcement at {}", file.display());

fs::create_dir_all(&dir).await.with_context(|| {
format!("Failed to create directory `{}`", dir.display())
})?;
Expand All @@ -72,7 +76,7 @@ async fn create_file(year: i32, week: u32) -> anyhow::Result<File> {
}

async fn generate_announcement(
week: u32,
week: &str,
date: String,
version: String,
sponsors: String,
Expand Down
30 changes: 0 additions & 30 deletions tools/release-operator/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,36 +219,6 @@ impl Crate {
break;
}

let delay = Duration::from_secs(10);
let start_time = Instant::now();
let timeout = Duration::from_secs(600);

log::info!(
"{self} should appear as {ours} on the registry, waiting... [{delay:?}|{timeout:?}]"
);

loop {
if Instant::now() - start_time > timeout {
return Err(anyhow!("{self} did not appear as {ours} on the registry within {timeout:?}"));
}

let theirs = self.get_upstream_version()?;

match theirs.cmp(&ours) {
std::cmp::Ordering::Less => (),
std::cmp::Ordering::Equal => {
log::info!("{self} appeared as {ours} on the registry");
break;
}
std::cmp::Ordering::Greater => {
return Err(anyhow!("{self} appeared as {theirs} on the registry which is newer than the current release ({ours})"))
},
}

log::info!("{self} waiting for {ours}...");
std::thread::sleep(delay);
}

Ok(())
}
}
Expand Down