get_bundle_name.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env node
  2. import { readFileSync } from "fs"
  3. import { join, dirname } from "path"
  4. import { fileURLToPath } from "url"
  5. const __filename = fileURLToPath(import.meta.url)
  6. const __dirname = dirname(__filename)
  7. /**
  8. * Get the bundle zip file name based on version from gradle.properties
  9. */
  10. function getBundleName() {
  11. try {
  12. // Read version from gradle.properties
  13. const gradlePropertiesPath = join(__dirname, "../gradle.properties")
  14. const gradlePropertiesContent = readFileSync(gradlePropertiesPath, "utf8")
  15. const gradleVersionMatch = gradlePropertiesContent.match(/^pluginVersion=(.+)$/m)
  16. if (!gradleVersionMatch) {
  17. throw new Error("pluginVersion not found in gradle.properties")
  18. }
  19. const version = gradleVersionMatch[1].trim()
  20. // Generate the bundle name following the pattern: Kilo Code-{version}.zip
  21. const bundleName = `Kilo Code-${version}.zip`
  22. // Output just the filename for CI usage
  23. process.stdout.write(bundleName)
  24. return bundleName
  25. } catch (error) {
  26. console.error("❌ Error getting bundle name:", error.message)
  27. process.exit(1)
  28. }
  29. }
  30. // Run the function if this script is executed directly
  31. if (import.meta.url === `file://${process.argv[1]}`) {
  32. getBundleName()
  33. }
  34. export default getBundleName