diff --git a/.github/workflows/BuildMpk.yml b/.github/workflows/BuildMpk.yml index 4a3019af7..3bc683026 100644 --- a/.github/workflows/BuildMpk.yml +++ b/.github/workflows/BuildMpk.yml @@ -54,7 +54,7 @@ jobs: - name: "Upload MPK artifact" uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4 with: - name: ${{ env.ARTIFACT_NAME }} + name: ${{ env.ARTIFACT_NAME }}-${{ steps.bump_version.outputs.VERSION }} path: ${{ env.ARTIFACT_PATH }} if-no-files-found: error diff --git a/scripts/release/build-mpk.ts b/scripts/release/build-mpk.ts index cd315fa66..37c1f7d7a 100644 --- a/scripts/release/build-mpk.ts +++ b/scripts/release/build-mpk.ts @@ -1,5 +1,5 @@ import { basename, join, dirname } from "path"; -import { readdir, copyFile, rm, mkdir } from "fs/promises"; +import { readdir, copyFile, rm, mkdir, rename } from "fs/promises"; import { appendFileSync } from "fs"; import { execShellCommand, @@ -101,6 +101,16 @@ async function main(): Promise { throw new Error(`${LOG_PREFIX} No implementation for MODULE="${inputs.module}"`); } +async function appendVersionToMpkFilename(mpkPath: string): Promise { + const versionedMpkPath = mpkPath.replace(/\.mpk$/, `-v${inputs.version}.mpk`); + if (versionedMpkPath === mpkPath) { + throw new Error(`${LOG_PREFIX} Expected an .mpk file path, got: ${mpkPath}`); + } + await rename(mpkPath, versionedMpkPath); + log(`Renamed MPK to include version: ${versionedMpkPath}`); + return versionedMpkPath; +} + async function createNativeMobileResourcesModule(): Promise { log("Creating the Native Mobile Resource module..."); const moduleFolder = join(repoRootPath, "packages/jsActions", inputs.module); @@ -130,8 +140,9 @@ async function createNativeMobileResourcesModule(): Promise { log(`MPK created at: ${mpkOutput}`); log("Exporting module with widgets into MPK..."); await exportModuleWithWidgets(moduleInfo.moduleNameInModeler, mpkOutput, nativeWidgetFolders, ossFiles); + const versionedMpkOutput = await appendVersionToMpkFilename(mpkOutput); return { - artifactPath: mpkOutput, + artifactPath: versionedMpkOutput, artifactName: moduleInfo.moduleNameInModeler }; } @@ -162,8 +173,9 @@ async function createNanoflowCommonsModule(): Promise { log(`MPK created at: ${mpkOutput}`); log("Copying OSS files into MPK..."); await copyFilesToMpk(ossFiles, mpkOutput, moduleInfo.moduleNameInModeler); + const versionedMpkOutput = await appendVersionToMpkFilename(mpkOutput); return { - artifactPath: mpkOutput, + artifactPath: versionedMpkOutput, artifactName: moduleInfo.moduleNameInModeler }; } diff --git a/scripts/release/module-automation/utils.ts b/scripts/release/module-automation/utils.ts index b7ff2ab57..4ca35e96d 100644 --- a/scripts/release/module-automation/utils.ts +++ b/scripts/release/module-automation/utils.ts @@ -24,7 +24,7 @@ export async function getOssFiles( } const readmePattern = "*__*__READMEOSS_*.html"; - const readme = globSync(readmePattern, { cwd: folderPath, absolute: true, ignore: "**/.*/**" })[0]; + const readme = globSync(readmePattern, { cwd: folderPath, absolute: true })[0]; if (validationCriteria) { validateOssReadme(readme, validationCriteria); }