Skip to content
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
5 changes: 3 additions & 2 deletions scripts/release/gh-release-atlas-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
});

Expand Down
13 changes: 10 additions & 3 deletions scripts/release/gh-release-atlas-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
githubAuthentication,
cloneRepo,
createMPK,
createGithubRelease,
createGithubReleaseFrom,
regex
} = require("./module-automation/commons");

Expand All @@ -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.");
};
Expand Down
5 changes: 3 additions & 2 deletions scripts/release/gh-release-atlas-web-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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...`);
Expand All @@ -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
});

Expand Down
19 changes: 7 additions & 12 deletions scripts/release/module-automation/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(" ");
Expand Down Expand Up @@ -340,7 +336,6 @@ module.exports = {
updateChangelogs,
cloneRepo,
createMPK,
createGithubRelease,
createGithubReleaseFrom,
writeToWidgetChangelogs,
zip,
Expand Down
Loading