Skip to content

Commit

Permalink
[1.1.x] chore(metadata): ensure build metadata is up-to-date (#1009)
Browse files Browse the repository at this point in the history
* chore(metadata): ensure build metadata is up-to-date

Signed-off-by: Paul Schultz <[email protected]>

* apply requested changes

Signed-off-by: Paul Schultz <[email protected]>

---------

Signed-off-by: Paul Schultz <[email protected]>
Co-authored-by: Paul Schultz <[email protected]>
  • Loading branch information
openshift-cherrypick-robot and schultzp2020 authored Feb 26, 2024
1 parent edc1b4e commit f935de2
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions scripts/update-backstage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,32 @@ function updateBackstageVersionFile(version) {
writeFileSync('backstage.json', modifiedContent, 'utf8');
}

function updateBuildMetadata(backstageVersion) {
const buildMetadataPath = join(
process.cwd(),
'packages',
'app',
'src',
'build-metadata.json',
);
const buildMetadata = JSON.parse(readFileSync(buildMetadataPath, 'utf8'));

const rootPackageJson = JSON.parse(readFileSync('package.json', 'utf8'));
const rhdhVersion = rootPackageJson.version;

const card = [
`RHDH Version: ${rhdhVersion}`,
`Backstage Version: ${backstageVersion}`,
];
buildMetadata.card = card;

writeFileSync(
buildMetadataPath,
JSON.stringify(buildMetadata, null, 2),
'utf8',
);
}

console.log('Bumping version...');
execSync('yarn run versions:bump', { stdio: 'inherit' });

Expand All @@ -138,9 +164,14 @@ execSync('yarn run export-dynamic --no-cache -- -- --clean', {
});

console.log('Fetching latest Backstage version...');
const latestVersion = await getLatestBackstageVersion();
const backstageVersion = await getLatestBackstageVersion();

console.log(`Updating backstage.json to ${backstageVersion}...`);
updateBackstageVersionFile(backstageVersion);

console.log(`Updating backstage.json to ${latestVersion}...`);
updateBackstageVersionFile(latestVersion);
console.log('Updating build metadata...');
updateBuildMetadata(backstageVersion);

console.log(`Successfully updated the Backstage Showcase to ${latestVersion}!`);
console.log(
`Successfully updated the Backstage Showcase to ${backstageVersion}!`,
);

0 comments on commit f935de2

Please sign in to comment.