From 8ca4c1819f3e7a8716c68034e256355334d53b44 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 1 Apr 2022 11:11:53 -0400 Subject: [PATCH] chore(ci): fix Releases.md creation and tag name (#14166) --- tools/release/01_bump_crate_versions.ts | 17 +++++++++++------ tools/release/04_create_release_tag.ts | 11 ++++++----- tools/release/deps.ts | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index 70c92637e7..c87be4591d 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -78,17 +78,22 @@ async function getReleasesMdText() { } async function getGitLog() { - const lastVersion = semver.parse(originalCliVersion)!; - const lastVersionTag = `v${originalCliVersion}`; + const originalVersion = semver.parse(originalCliVersion)!; + const originalVersionTag = `v${originalCliVersion}`; // fetch the upstream tags await repo.gitFetchTags("upstream"); + // make the repo unshallow so we can fetch the latest tag + if (await repo.gitIsShallow()) { + await repo.gitFetchUnshallow("origin"); + } + // this means we're on the patch release const latestTag = await repo.gitLatestTag(); - if (latestTag === lastVersionTag) { + if (latestTag === originalVersionTag) { return await repo.getGitLogFromTags( "upstream", - lastVersionTag, + originalVersionTag, undefined, ); } else { @@ -96,8 +101,8 @@ async function getGitLog() { await repo.gitFetchHistory("upstream"); const lastMinorHistory = await repo.getGitLogFromTags( "upstream", - `v${lastVersion.major}.${lastVersion.minor}.0`, - lastVersionTag, + `v${originalVersion.major}.${originalVersion.minor}.0`, + originalVersionTag, ); const currentHistory = await repo.getGitLogFromTags( "upstream", diff --git a/tools/release/04_create_release_tag.ts b/tools/release/04_create_release_tag.ts index 1a770e6cd8..8eaac2514a 100755 --- a/tools/release/04_create_release_tag.ts +++ b/tools/release/04_create_release_tag.ts @@ -1,4 +1,4 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo --no-check +#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo,git --no-check // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; @@ -8,10 +8,11 @@ const cliCrate = workspace.getCliCrate(); await repo.gitFetchTags("origin"); const tags = await repo.getGitTags(); +const tagName = `v${cliCrate.version}`; -if (tags.has(cliCrate.version)) { - console.log(`Tag ${cliCrate.version} already exists.`); +if (tags.has(tagName)) { + console.log(`Tag ${tagName} already exists.`); } else { - await repo.gitTag(cliCrate.version); - await repo.gitPush(cliCrate.version); + await repo.gitTag(tagName); + await repo.gitPush(tagName); } diff --git a/tools/release/deps.ts b/tools/release/deps.ts index 9c23e509e7..75cc872a12 100644 --- a/tools/release/deps.ts +++ b/tools/release/deps.ts @@ -1,4 +1,4 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -export * from "https://raw.githubusercontent.com/denoland/automation/0.9.0/mod.ts"; -export * from "https://raw.githubusercontent.com/denoland/automation/0.9.0/github_actions.ts"; +export * from "https://raw.githubusercontent.com/denoland/automation/0.9.2/mod.ts"; +export * from "https://raw.githubusercontent.com/denoland/automation/0.9.2/github_actions.ts";