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

Releases notes should have their order inverted #538

Closed
Eric-Arellano opened this issue Dec 19, 2023 · 0 comments · Fixed by #587
Closed

Releases notes should have their order inverted #538

Eric-Arellano opened this issue Dec 19, 2023 · 0 comments · Fixed by #587
Assignees

Comments

@Eric-Arellano
Copy link
Collaborator

I didn't realize when we added release notes that we have release notes in ascending order, like 0.25.0 then 0.25.1. They should be in descending order so that it's chronological, like 0.25.1 then 0.25.0.

@Eric-Arellano Eric-Arellano added this to the 24-02-13 Qiskit 1.0 milestone Dec 19, 2023
@Eric-Arellano Eric-Arellano moved this to In Progress in Docs Planning Dec 29, 2023
github-merge-queue bot pushed a commit that referenced this issue Jan 5, 2024
This PR changes the release notes to have a chronological descending
order.

#### How to regenerate the release notes

To regenerate the release notes and fix the order of each version, I
used the API generation script with some changes. We need to modify the
writeSeparateReleaseNotes function from `releaseNotes.ts` and the
`updateApiDocs.ts` script.

The first step is to comment the `extractMarkdownReleaseNotesPatches`
call in line 245, given that we don't want to write the latest release
notes file. Also, we need to substitute the two arrays returned by that
call for the release notes we want to regenerate and an empty
dictionary. I did the regeneration in batches of 6 files:

```ts
//const [minorVersionsFound, markdownByPatchVersion] =
//  extractMarkdownReleaseNotesPatches(releaseNoteMarkdown);

const markdownByPatchVersion: {
  [id: string]: string;
} = {};

const minorVersionsFound = ['0.10', '0.15', '0.14', '0.13', '0.12', '0.11'];
```

The following step is to add some logic to read all the files and store
each patch version we find in each file. With that information, we will
re-write each release notes file at the end of the function with the
correct order. That piece of code was extracted from the first version
of the script which can be found in this commit
7aa586f.
It was copied in the same place it appear in the commit.

```ts
const [_, markdownByPatchOldVersion] =
extractMarkdownReleaseNotesPatches(currentMarkdown);

for (let [versionPatch, markdownPatch] of Object.entries(
  markdownByPatchOldVersion,
)) {
  // We keep the release notes for a patch if it hasn't been modified for the current release notes.
  // Otherwise, we use the modified version.
  if (!markdownByPatchVersion.hasOwnProperty(versionPatch)) {
    markdownByPatchVersion[versionPatch] = markdownPatch;
  }
}
```

Finally, to speed up the process, I commented the files we regenerate in
the `updateApiDocs.ts` script. This step is optional, and if used we
have to make sure we restore all the docs before creating the PR.

```ts
async function convertHtmlToMarkdown(
  htmlPath: string,
  markdownPath: string,
  baseSourceUrl: string,
  pkg: Pkg,
) {
  const files = await globby(
    [
      //"apidocs/**.html",
      //"apidoc/**.html",
      //"stubs/**.html",
      "release_notes.html",
    ],
    {
      cwd: htmlPath,
    },
  );
```
Closes #538
@github-project-automation github-project-automation bot moved this from In Progress to Done in Docs Planning Jan 5, 2024
github-actions bot pushed a commit that referenced this issue Jan 9, 2024
This PR changes the release notes to have a chronological descending
order.

#### How to regenerate the release notes

To regenerate the release notes and fix the order of each version, I
used the API generation script with some changes. We need to modify the
writeSeparateReleaseNotes function from `releaseNotes.ts` and the
`updateApiDocs.ts` script.

The first step is to comment the `extractMarkdownReleaseNotesPatches`
call in line 245, given that we don't want to write the latest release
notes file. Also, we need to substitute the two arrays returned by that
call for the release notes we want to regenerate and an empty
dictionary. I did the regeneration in batches of 6 files:

```ts
//const [minorVersionsFound, markdownByPatchVersion] =
//  extractMarkdownReleaseNotesPatches(releaseNoteMarkdown);

const markdownByPatchVersion: {
  [id: string]: string;
} = {};

const minorVersionsFound = ['0.10', '0.15', '0.14', '0.13', '0.12', '0.11'];
```

The following step is to add some logic to read all the files and store
each patch version we find in each file. With that information, we will
re-write each release notes file at the end of the function with the
correct order. That piece of code was extracted from the first version
of the script which can be found in this commit
7aa586f.
It was copied in the same place it appear in the commit.

```ts
const [_, markdownByPatchOldVersion] =
extractMarkdownReleaseNotesPatches(currentMarkdown);

for (let [versionPatch, markdownPatch] of Object.entries(
  markdownByPatchOldVersion,
)) {
  // We keep the release notes for a patch if it hasn't been modified for the current release notes.
  // Otherwise, we use the modified version.
  if (!markdownByPatchVersion.hasOwnProperty(versionPatch)) {
    markdownByPatchVersion[versionPatch] = markdownPatch;
  }
}
```

Finally, to speed up the process, I commented the files we regenerate in
the `updateApiDocs.ts` script. This step is optional, and if used we
have to make sure we restore all the docs before creating the PR.

```ts
async function convertHtmlToMarkdown(
  htmlPath: string,
  markdownPath: string,
  baseSourceUrl: string,
  pkg: Pkg,
) {
  const files = await globby(
    [
      //"apidocs/**.html",
      //"apidoc/**.html",
      //"stubs/**.html",
      "release_notes.html",
    ],
    {
      cwd: htmlPath,
    },
  );
```
Closes #538
frankharkins pushed a commit to frankharkins/documentation that referenced this issue Jul 22, 2024
This PR changes the release notes to have a chronological descending
order.

#### How to regenerate the release notes

To regenerate the release notes and fix the order of each version, I
used the API generation script with some changes. We need to modify the
writeSeparateReleaseNotes function from `releaseNotes.ts` and the
`updateApiDocs.ts` script.

The first step is to comment the `extractMarkdownReleaseNotesPatches`
call in line 245, given that we don't want to write the latest release
notes file. Also, we need to substitute the two arrays returned by that
call for the release notes we want to regenerate and an empty
dictionary. I did the regeneration in batches of 6 files:

```ts
//const [minorVersionsFound, markdownByPatchVersion] =
//  extractMarkdownReleaseNotesPatches(releaseNoteMarkdown);

const markdownByPatchVersion: {
  [id: string]: string;
} = {};

const minorVersionsFound = ['0.10', '0.15', '0.14', '0.13', '0.12', '0.11'];
```

The following step is to add some logic to read all the files and store
each patch version we find in each file. With that information, we will
re-write each release notes file at the end of the function with the
correct order. That piece of code was extracted from the first version
of the script which can be found in this commit
Qiskit@7aa586f.
It was copied in the same place it appear in the commit.

```ts
const [_, markdownByPatchOldVersion] =
extractMarkdownReleaseNotesPatches(currentMarkdown);

for (let [versionPatch, markdownPatch] of Object.entries(
  markdownByPatchOldVersion,
)) {
  // We keep the release notes for a patch if it hasn't been modified for the current release notes.
  // Otherwise, we use the modified version.
  if (!markdownByPatchVersion.hasOwnProperty(versionPatch)) {
    markdownByPatchVersion[versionPatch] = markdownPatch;
  }
}
```

Finally, to speed up the process, I commented the files we regenerate in
the `updateApiDocs.ts` script. This step is optional, and if used we
have to make sure we restore all the docs before creating the PR.

```ts
async function convertHtmlToMarkdown(
  htmlPath: string,
  markdownPath: string,
  baseSourceUrl: string,
  pkg: Pkg,
) {
  const files = await globby(
    [
      //"apidocs/**.html",
      //"apidoc/**.html",
      //"stubs/**.html",
      "release_notes.html",
    ],
    {
      cwd: htmlPath,
    },
  );
```
Closes Qiskit#538
@javabster javabster removed this from Docs Planning Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants