Skip to content

Commit

Permalink
chore(repo): fix docs release (#29233)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Docs fail to release with the new typescript version

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Docs can be released and release flow can be tested via `--dryRun`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
FrozenPandaz authored Dec 6, 2024
1 parent c3b4bf6 commit d23350f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion scripts/release-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);

Expand All @@ -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}`
);
Expand Down

0 comments on commit d23350f

Please sign in to comment.