feat(web): point unreleased docs install snippet at main manifest

The unversioned "current" docs describe unreleased functionality, so
a tagged release manifest doesn't make sense there. Install from the
manifest built off main instead.

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
Marco Nenciarini 2026-08-25 12:23:36 +02:00 committed by Francesco Canovai
parent a28fd19113
commit b547b6f05b

View File

@ -1,15 +1,21 @@
import {ReactElement} from 'react'; import {ReactElement} from 'react';
import CodeBlock from '@theme/CodeBlock'; import CodeBlock from '@theme/CodeBlock';
import {useActiveVersion} from '@docusaurus/plugin-content-docs/client';
import {useCurrentVersion} from '@site/src/hooks/versions'; import {useCurrentVersion} from '@site/src/hooks/versions';
// InstallationSnippet is the kubectl incantation to install the lastest // InstallationSnippet is the kubectl incantation to install the Barman
// available version of the Barman Cloud Plugin. // Cloud Plugin: the manifest matching the doc version being viewed, or
// (on the unreleased "current" docs) the latest manifest on main.
export function InstallationSnippet(): ReactElement<null> { export function InstallationSnippet(): ReactElement<null> {
const latest = useCurrentVersion('latest'); const activeVersion = useActiveVersion('default');
const version = useCurrentVersion('latest');
const url = activeVersion?.name === 'current'
? 'https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml'
: `https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${version}/manifest.yaml`;
return ( return (
<CodeBlock language="sh"> <CodeBlock language="sh">
{`kubectl apply -f \\ {`kubectl apply -f \\
https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${latest}/manifest.yaml`} ${url}`}
</CodeBlock> </CodeBlock>
); );
} }