Skip to content

Commit 3dbbef0

Browse files
committed
improve logic
Signed-off-by: Harta Angkasa <[email protected]>
1 parent f819843 commit 3dbbef0

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

build-automation.mjs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,31 @@ export default async function(github) {
113113
} else {
114114
const newVersions = await checkForMuslVersionsAndSecurityReleases(github, versions);
115115
let updatedVersions = [];
116+
116117
for (const [version, newVersion] of Object.entries(newVersions)) {
117-
if (newVersion.alpineOnly) {
118-
if (newVersion.muslBuildExists) {
119-
console.log(`Catch-up Alpine build for version ${newVersion.fullVersion}`);
120-
const { stdout } = await exec(`./update.sh ${version} alpine`);
121-
console.log(stdout);
122-
updatedVersions.push(`${newVersion.fullVersion} (alpine)`);
118+
const { fullVersion, muslBuildExists, isSecurityRelease, alpineOnly } = newVersion;
119+
// If MUSL is available: build everything (new versions) or alpine only (catch-up)
120+
if (muslBuildExists) {
121+
const updateScope = alpineOnly ? "alpine" : "";
122+
123+
console.log(`MUSL available. Updating ${fullVersion} ${updateScope}.`.trim());
124+
const { stdout } = await exec(`./update.sh ${version} ${updateScope}`.trim());
125+
console.log(stdout);
126+
127+
updatedVersions.push(`${fullVersion} ${updateScope}`.trim());
128+
// Security release: no MUSL build
129+
} else if (isSecurityRelease && !alpineOnly) {
130+
console.log(`Updating ${fullVersion} for non-alpine.`);
131+
132+
const { stdout } = await exec(`./update.sh -s ${version}`);
133+
console.log(stdout);
134+
135+
updatedVersions.push(`${fullVersion} (non-alpine)`);
123136
} else {
124-
console.log(`There's no musl build for version ${newVersion.fullVersion} yet. Skipping Alpine catch-up.`);
137+
console.log(`No MUSL build for ${fullVersion} yet.`);
125138
}
126-
} else if (newVersion.isSecurityRelease) {
127-
console.log(`Processing security release ${newVersion.fullVersion}`);
128-
const { stdout } = await exec(`./update.sh -s ${version}`);
129-
console.log(stdout);
130-
updatedVersions.push(newVersion.fullVersion);
131-
} else if (newVersion.muslBuildExists) {
132-
const { stdout } = await exec(`./update.sh ${version}`);
133-
console.log(stdout);
134-
updatedVersions.push(newVersion.fullVersion);
135-
} else {
136-
// No musl build - update non-alpine only
137-
console.log(`There's no musl build for version ${newVersion.fullVersion} yet. Updating non-alpine only.`);
138-
const { stdout } = await exec(`./update.sh ${version} bookworm,bookworm-slim,bullseye,bullseye-slim,trixie,trixie-slim`);
139-
console.log(stdout);
140-
updatedVersions.push(`${newVersion.fullVersion} (non-alpine)`);
141-
}
142139
}
140+
143141
const { stdout } = (await exec(`git diff`));
144142
console.log(stdout);
145143

0 commit comments

Comments
 (0)