From d3f140289f9fce477489e18bb017f1965f026cf0 Mon Sep 17 00:00:00 2001 From: Roman Vyakhirev Date: Wed, 21 Jan 2026 11:20:21 +0100 Subject: [PATCH] fix: append target to release creation --- scripts/release/gh-release-atlas-core.js | 5 +++-- scripts/release/gh-release-atlas-native.js | 13 ++++++++++--- .../release/gh-release-atlas-web-content.js | 5 +++-- scripts/release/module-automation/commons.js | 19 +++++++------------ 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/release/gh-release-atlas-core.js b/scripts/release/gh-release-atlas-core.js index d52493814..41f8d4edc 100644 --- a/scripts/release/gh-release-atlas-core.js +++ b/scripts/release/gh-release-atlas-core.js @@ -46,7 +46,7 @@ module.exports = async function createAtlasCoreModule() { `No unreleased changes found in the CHANGELOG.md for ${moduleInfo.nameWithSpace} ${moduleInfo.version}.` ); } - await commitAndCreatePullRequest(moduleInfo); + const targetBranchName = await commitAndCreatePullRequest(moduleInfo); await updateTestProject(moduleInfo, testProject, tmp); const mpkOutput = await createMPK(testProject, moduleInfo, regex.excludeFiles); @@ -57,7 +57,8 @@ module.exports = async function createAtlasCoreModule() { title: `${moduleInfo.nameWithSpace} - Marketplace Release v${moduleInfo.version}`, body: moduleChangelogs.replace(/"/g, "'"), tag: `${moduleFolderNameInRepo}-v${moduleInfo.version}`, - mpkOutput, + target: targetBranchName, + filesToRelease: mpkOutput, isDraft: true }); diff --git a/scripts/release/gh-release-atlas-native.js b/scripts/release/gh-release-atlas-native.js index d680cd513..d4a4afbbe 100644 --- a/scripts/release/gh-release-atlas-native.js +++ b/scripts/release/gh-release-atlas-native.js @@ -10,7 +10,7 @@ const { githubAuthentication, cloneRepo, createMPK, - createGithubRelease, + createGithubReleaseFrom, regex } = require("./module-automation/commons"); @@ -29,12 +29,19 @@ module.exports = async function createAtlasNativeContentModule() { }; await githubAuthentication(moduleInfo); const moduleChangelogs = await updateModuleChangelogs(moduleInfo); - await commitAndCreatePullRequest(moduleInfo); + const targetBranchName = await commitAndCreatePullRequest(moduleInfo); await updateNativeComponentsTestProjectWithAtlas(moduleInfo, tmpFolder); const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles); console.log(`Change owner and group after module export...`); execSync(`sudo chown -R runner:docker ${tmpFolder}`, { stdio: "inherit" }); - await createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput); + console.log(`Creating Github release for module ${moduleInfo.nameWithSpace}`); + await createGithubReleaseFrom({ + title: `${moduleInfo.nameWithSpace} ${moduleInfo.version} - Mendix ${moduleInfo.minimumMXVersion}`, + body: moduleChangelogs, + target: targetBranchName, + tag: process.env.TAG, + filesToRelease: mpkOutput + }); await execShellCommand(`rm -rf ${tmpFolder}`); console.log("Done."); }; diff --git a/scripts/release/gh-release-atlas-web-content.js b/scripts/release/gh-release-atlas-web-content.js index e8b172c48..98fe3e1bb 100644 --- a/scripts/release/gh-release-atlas-web-content.js +++ b/scripts/release/gh-release-atlas-web-content.js @@ -56,7 +56,7 @@ module.exports = async function createAtlasWebContentModule() { `No unreleased changes found in the CHANGELOG.md for ${moduleInfo.nameWithSpace} ${moduleInfo.version}.` ); } - await commitAndCreatePullRequest(moduleInfo); + const targetBranchName = await commitAndCreatePullRequest(moduleInfo); await updateTestProject(moduleInfo, testProject, tmp); const mpkOutput = await createMPK(testProject, moduleInfo, regex.excludeFiles); console.log(`Change owner and group after module export...`); @@ -66,7 +66,8 @@ module.exports = async function createAtlasWebContentModule() { title: `${moduleInfo.nameWithSpace} - Marketplace Release v${moduleInfo.version}`, body: moduleChangelogs.replace(/"/g, "'"), tag: `${moduleFolderNameInRepo}-v${moduleInfo.version}`, - mpkOutput, + target: targetBranchName, + filesToRelease: mpkOutput, isDraft: true }); diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index 35bf16492..fc5b473b0 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -179,6 +179,8 @@ async function commitAndCreatePullRequest(moduleInfo) { `gh pr create --title "${moduleInfo.nameWithSpace}: Updating changelogs" --body "This is an automated PR." --base main --head ${changelogBranchName}` ); console.log("Created PR for changelog updates."); + + return changelogBranchName; } async function updateWidgetChangelogs(widgetsFolders) { @@ -248,24 +250,18 @@ async function createMPK(tmpFolder, moduleInfo, excludeFilesRegExp) { return (await getFiles(tmpFolder, [`.mpk`]))[0]; } -async function createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput) { - console.log(`Creating Github release for module ${moduleInfo.nameWithSpace}`); - await createGithubReleaseFrom({ - title: `${moduleInfo.nameWithSpace} ${moduleInfo.version} - Mendix ${moduleInfo.minimumMXVersion}`, - body: moduleChangelogs, - tag: process.env.TAG, - mpkOutput - }); -} +async function createGithubReleaseFrom(params) { + const { body, title, tag, filesToRelease = "", target, isDraft = false, repo } = params; -async function createGithubReleaseFrom({ title, body, tag, mpkOutput, isDraft = false }) { const command = [ `gh release create`, `--title '${title}'`, `--notes '${body}'`, isDraft ? "--draft" : "", + repo ? `-R '${repo}'` : "", `'${tag}'`, - `'${mpkOutput}'` + `--target '${target}'`, + filesToRelease ? `'${filesToRelease}'` : "" ] .filter(str => str !== "") .join(" "); @@ -340,7 +336,6 @@ module.exports = { updateChangelogs, cloneRepo, createMPK, - createGithubRelease, createGithubReleaseFrom, writeToWidgetChangelogs, zip,