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

Delete stale images #2529

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/images/api/qiskit/1.1/circuit-3.png
Binary file not shown.
Binary file removed public/images/api/qiskit/1.1/circuit-5.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed public/images/api/qiskit/circuit-3.png
Diff not rendered.
Binary file removed public/images/api/qiskit/circuit-5.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-1.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-2.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-3.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-4.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-5.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-6.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-7.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-8.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed public/images/guides/paulibasis.png
Diff not rendered.
32 changes: 0 additions & 32 deletions public/images/guides/sessions/ExtendedSession.svg
Diff not rendered.
38 changes: 0 additions & 38 deletions public/images/guides/sessions/[email protected]
Diff not rendered.
32 changes: 0 additions & 32 deletions public/images/guides/sessions/SessionTTL.svg
Diff not rendered.
34 changes: 0 additions & 34 deletions public/images/guides/sessions/[email protected]
Diff not rendered.
Binary file removed public/images/migration/admin-UI1.png
Diff not rendered.
Binary file removed public/images/migration/dedicated_queue1.jpg
Diff not rendered.
Diff not rendered.
Binary file removed public/images/migration/switcher-small2.png
Diff not rendered.
Binary file removed public/images/optimize/m3.png
Diff not rendered.
Binary file removed public/images/optimize/resilience-2.png
Diff not rendered.
Binary file removed public/images/optimize/sampling-overhead.png
Diff not rendered.
Binary file removed public/images/optimize/stratified.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
26 changes: 18 additions & 8 deletions scripts/js/lib/api/saveImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ import { Pkg } from "./Pkg.js";
import { Image } from "./HtmlToMdResult.js";
import { pathExists, rmFilesInFolder } from "../fs.js";

function skipReleaseNote(imgFileName: string, pkg: Pkg): boolean {
const isReleaseNote =
imgFileName.includes("release_notes") ||
imgFileName.includes("release-notes");
if (!isReleaseNote) return false;

if (pkg.hasSeparateReleaseNotes()) {
// If the pkg has dedicated release notes per release, we should copy its images
// unless it's the dev version. We don't (yet) support release notes for dev versions:
// https://github.com/Qiskit/documentation/issues/1296
return pkg.isDev();
} else {
// Else, if the pkg has only a single release note file, only 'latest' should copy images.
return !pkg.isLatest();
}
}

export async function saveImages(
images: Image[],
originalImagesFolderPath: string,
Expand All @@ -34,14 +51,7 @@ export async function saveImages(
}

await pMap(images, async (img) => {
// For packages with only a single release notes file, the release notes images are only saved
// in the current version to avoid having duplicate files.
if (
pkg.isHistorical() &&
(img.fileName.includes("release_notes") ||
img.fileName.includes("release-notes")) &&
!pkg.hasSeparateReleaseNotes()
) {
if (skipReleaseNote(img.fileName, pkg)) {
return;
}

Expand Down
2 changes: 0 additions & 2 deletions scripts/pr-previews/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ def _copy_local_content(root_dir: Path) -> None:
"docs/open-source",
"public/videos",
"public/images/guides",
"public/images/migration",
"public/images/optimize",
"public/images/qiskit-ibm-runtime",
"public/images/qiskit-patterns",
]:
dest = (
Expand Down
Loading