chore: make the start_release workflow go faster (#15416)

This commit is contained in:
David Sherret 2022-08-08 19:31:45 -04:00 committed by GitHub
parent daaa509ee5
commit af618e3b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 31 deletions

View File

@ -31,12 +31,7 @@ jobs:
git config --global fetch.parallel 32
- name: Clone repository
uses: actions/checkout@v2
with:
token: ${{ secrets.DENOBOT_PAT }}
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
uses: actions/checkout@v3
- name: Install deno
uses: denoland/setup-deno@v1
@ -45,8 +40,8 @@ jobs:
# the latest version ever has issues that breaks publishing
deno-version: v1.23.2
- name: Run start release
- name: Create Gist URL
env:
GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }}
GITHUB_TOKEN: ${{ secrets.DENOBOT_GIST_PAT }}
GH_WORKFLOW_ACTOR: ${{ github.actor }}
run: ./tools/release/00_start_release.ts --${{github.event.inputs.releaseKind}}

View File

@ -3,6 +3,6 @@
1. Go to this workflow:
https://github.com/denoland/deno/actions/workflows/start_release.yml
1. Select the kind of release, then run the workflow.
1. In the "Run start release" step, look at the bottom of the output to get the
gist url.
1. Fork the gist, and follow the instructions.
1. Wait for the "Create Gist URL" step to complete and look at its output for
the Gist URL.
1. Follow the instructions in the gist.

33
tools/release/00_start_release.ts Normal file → Executable file
View File

@ -1,20 +1,19 @@
#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json
#!/usr/bin/env -S deno run -A --quiet --lock=tools/deno.lock.json
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { DenoWorkspace } from "./deno_workspace.ts";
import { $, createOctoKit, semver } from "./deps.ts";
$.logStep("Loading cli crate...");
const workspace = await DenoWorkspace.load();
const cliCrate = workspace.getCliCrate();
const nextVersion = getNextVersion(semver.parse(cliCrate.version)!);
const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url));
$.logStep("Getting next version...");
const nextVersion = getNextVersion(semver.parse(getCliVersion())!);
$.logStep("Creating gist with instructions...");
const octoKit = createOctoKit();
const result = await octoKit.request("POST /gists", {
description: `Deno CLI v${nextVersion.toString()} release checklist`,
description: `Deno CLI v${nextVersion} release checklist`,
public: false,
files: {
"release_instructions.md": {
[`release_${nextVersion}.md`]: {
content: buildDenoReleaseInstructionsDoc(),
},
},
@ -23,7 +22,7 @@ const result = await octoKit.request("POST /gists", {
$.log("==============================================");
$.log("Created gist with instructions!");
$.log("");
$.log(` ${result.url}`);
$.log(` ${result.data.html_url}`);
$.log("");
$.log("Please fork the gist and follow the checklist.");
$.log("==============================================");
@ -41,9 +40,23 @@ function getNextVersion(originalVersion: semver.SemVer) {
}
function buildDenoReleaseInstructionsDoc() {
const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url));
const templateText = Deno.readTextFileSync(
$.path.join(currentDirPath, "release_doc_template.md"),
);
return `# Deno CLI ${nextVersion.toString()} Release Checklist\n\n${templateText}`;
}
function getCliVersion() {
const cargoTomlText = Deno.readTextFileSync(
$.path.join(currentDirPath, "../../cli/Cargo.toml"),
);
const result = cargoTomlText.match(/^version\s*=\s*"([^"]+)"$/m);
if (result == null || result.length !== 2) {
$.log("Cargo.toml");
$.log("==========");
$.log(cargoTomlText);
$.log("==========");
throw new Error("Could not find version in text.");
}
return result[1];
}

View File

@ -1,4 +1,6 @@
## Pre-flight checklist
- [ ] Fork this gist and follow the instructions there.
## Pre-flight
- Forks and local clones of
[`denoland/deno`](https://github.com/denoland/deno/),
@ -13,7 +15,7 @@ release from) should be frozen and no commits should land until the release is
cut.**
- [ ] Write a message in company's #cli channel:
`:lock: deno and deno_std are now locked (<LINK TO THIS GIST GOES HERE>)`
`:lock: deno and deno_std are now locked (<LINK TO THIS FORKED GIST GOES HERE>)`
## Patch release preparation
@ -51,7 +53,7 @@ verify on GitHub that everything looks correct.
- ⛔ DO NOT create a release tag manually. That will automatically happen.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. Checkout the latest main.
2. Manually run `./_tools/release/01_bump_version.ts --minor`
@ -67,7 +69,7 @@ verify on GitHub that everything looks correct.
- [ ] Review the draft release and then publish it.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. Tag the repo manually in the format `x.x.x`
2. Draft a new GH release by copying and pasting the release notes from
@ -90,10 +92,10 @@ verify on GitHub that everything looks correct.
- [ ] Wait for the workflow to complete and for a pull request to be
automatically opened. Review the pull request, make any necessary changes,
and merge it.
- ⛔ DO NOT create a release tag manually.
- ⛔ DO NOT create a release tag manually That will automatically happen.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. Checkout the branch the release is being made on.
2. Manually run `./tools/release/01_bump_crate_versions.ts`
@ -110,7 +112,7 @@ verify on GitHub that everything looks correct.
1. Run it on the same branch that you used before and wait for it to complete.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. The workflow was designed to be restartable. Try restarting it.
2. If that doesn't work, then do the following:
@ -140,7 +142,8 @@ verify on GitHub that everything looks correct.
- ⛔ Verify that:
- [ ] There are 8 assets on the release draft.
- [ ] There are 4 zip files for this version on dl.deno.land
- [ ] There are 4 zip files for this version on
[dl.deno.land](https://console.cloud.google.com/storage/browser/dl.deno.land/release).
- [ ] The aarch64 Mac build was built from the correct branch AFTER the
version bump and has the same version as the release when doing
`deno -V` (ask someone with an M1 Mac to verify this if you don't have
@ -154,7 +157,7 @@ verify on GitHub that everything looks correct.
- [ ] This should open a PR. Review and merge it.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. Update https://github.com/denoland/dotland/blob/main/versions.json
manually.
@ -183,7 +186,7 @@ queries the GitHub API to determine what it needs to change and update.
- This will open a PR. Review it and merge, which will trigger a deployment.
<details>
<summary>Failure Steps</summary>
<summary>Failure Steps</summary>
1. Checkout a new branch for docland (e.g. `git checkout -b deno_1.17.0`).
2. Execute `deno task build`