@@ -814,6 +814,11 @@ tasks.register('release') {
814814 exclude ' deps.properties'
815815 }
816816
817+ // Create VERSION file in prep directory (for archive)
818+ def versionFilePrep = file(" ${ bundleTmpPrepPath} /${ bundleName} VERSION" )
819+ versionFilePrep. text = bundleVersion
820+ println " Created VERSION file for archive: ${ versionFilePrep.name} "
821+
817822 // Copy to bundles_build directory (non-zip dev artifact)
818823 // Structure: bearsampp-build/tmp/bundles_build/tools/powershell/powershell7.5.4/
819824 println " "
@@ -866,18 +871,33 @@ tasks.register('release') {
866871
867872 println " Using 7-Zip: ${ sevenZipExe} "
868873
869- // Create 7z archive (standard Bruno approach - archive the directory contents)
874+ // Create archive with directory structure: powershell7.5.4/...
875+ // First, create a staging directory with the proper structure
876+ def archiveStagingPath = file(" ${ buildTmpPath} /bundles_archive/${ bundleType} /${ bundleName} " )
877+ if (archiveStagingPath. exists()) {
878+ delete archiveStagingPath
879+ }
880+ archiveStagingPath. mkdirs()
881+
882+ // Copy prep contents into versioned directory
883+ def versionedDir = file(" ${ archiveStagingPath} /${ bundleName}${ bundleVersion} " )
884+ copy {
885+ from bundleTmpPrepPath
886+ into versionedDir
887+ }
888+
889+ // Create 7z archive from staging directory
870890 def command = [
871891 sevenZipExe,
872892 ' a' ,
873893 ' -t7z' ,
874894 archiveFile. absolutePath. toString(),
875- ' . '
895+ " ${ bundleName }${ bundleVersion } "
876896 ]
877897
878- // Run from the prep directory to archive its contents
898+ // Run from the staging directory to archive the versioned folder
879899 def process = new ProcessBuilder (command as String [])
880- .directory(bundleTmpPrepPath )
900+ .directory(archiveStagingPath )
881901 .redirectErrorStream(true )
882902 .start()
883903
@@ -905,8 +925,25 @@ tasks.register('release') {
905925
906926 println " Compressing ${ bundleName} -${ bundleVersion} to ${ archiveFile.name} ..."
907927
908- // Archive the directory contents (standard Bruno approach)
909- ant. zip(destfile : archiveFile, basedir : bundleTmpPrepPath)
928+ // Create archive with directory structure: powershell7.5.4/...
929+ // Create a staging directory with the proper structure
930+ def archiveStagingPath = file(" ${ buildTmpPath} /bundles_archive/${ bundleType} /${ bundleName} " )
931+ if (archiveStagingPath. exists()) {
932+ delete archiveStagingPath
933+ }
934+ archiveStagingPath. mkdirs()
935+
936+ // Copy prep contents into versioned directory
937+ def versionedDir = file(" ${ archiveStagingPath} /${ bundleName}${ bundleVersion} " )
938+ copy {
939+ from bundleTmpPrepPath
940+ into versionedDir
941+ }
942+
943+ // Archive the versioned directory
944+ ant. zip(destfile : archiveFile) {
945+ zipfileset(dir : archiveStagingPath, includes : " **/*" )
946+ }
910947
911948 println " Archive created: ${ archiveFile} "
912949
0 commit comments