From d23350fbc02ad197facc1f604c5b19994c299491 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 6 Dec 2024 14:09:18 -0500 Subject: [PATCH] chore(repo): fix docs release (#29233) ## Current Behavior Docs fail to release with the new typescript version ## Expected Behavior Docs can be released and release flow can be tested via `--dryRun` ## Related Issue(s) Fixes # --- .github/workflows/publish.yml | 2 +- scripts/release-docs.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dafacf9b3f541..63f38428edf92 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -419,7 +419,7 @@ jobs: - name: (Stable Release Only) Trigger Docs Release # Publish docs only on a full release if: ${{ !github.event.release.prerelease && github.event_name == 'release' }} - run: npx ts-node ./scripts/release-docs.ts + run: npx ts-node -P ./scripts/tsconfig.scripts.json ./scripts/release-docs.ts - name: (PR Release Only) Create comment for successful PR release if: success() && github.event.inputs.pr diff --git a/scripts/release-docs.ts b/scripts/release-docs.ts index 8aa96075c9bef..0569352e5d27c 100644 --- a/scripts/release-docs.ts +++ b/scripts/release-docs.ts @@ -3,6 +3,10 @@ import { gte, major, maxSatisfying } from 'semver'; // The GITHUB_REF_NAME is a full version (i.e. 17.3.2). The branchName will strip the patch version number. // We will publish docs to the website branch based on the current tag (i.e. website-17) +const dryRun = process.argv.includes('--dryRun'); +if (dryRun) { + console.log('Dry run mode enabled'); +} const currentVersion = process.env.GITHUB_REF_NAME || ''; console.log(`Comparing ${currentVersion} to npm versions`); @@ -20,7 +24,12 @@ console.log(`Found npm versions:\n${releasedVersions.join('\n')}`); // Publish if the current version is greater than or equal to the latest released version const branchName = `website-${majorVersion}`; -if (currentVersion && latestVersion && gte(currentVersion, latestVersion)) { +if ( + !dryRun && + currentVersion && + latestVersion && + gte(currentVersion, latestVersion) +) { console.log( `Publishing docs site for ${process.env.GITHUB_REF_NAME} to ${branchName}` );