Browse Source

[build] Use snapshot version from build index

Him188 2 years ago
parent
commit
77132eee41

+ 5 - 5
ci-release-helper/build.gradle.kts

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2019-2022 Mamoe Technologies and contributors.
+ * Copyright 2019-2023 Mamoe Technologies and contributors.
  *
  *
  * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@@ -104,19 +104,19 @@ tasks.register("updateSnapshotVersion") {
         result.assertNormalExitValue()
         result.assertNormalExitValue()
 
 
         val resultString = out.toByteArray().decodeToString()
         val resultString = out.toByteArray().decodeToString()
-        val index = resultString
+        val branchAndIndex = resultString
             .substringAfter("<SNAPSHOT_VERSION_START>", "")
             .substringAfter("<SNAPSHOT_VERSION_START>", "")
             .substringBefore("<SNAPSHOT_VERSION_END>", "")
             .substringBefore("<SNAPSHOT_VERSION_END>", "")
 
 
         logger.info("Exec result:")
         logger.info("Exec result:")
         logger.info(resultString)
         logger.info(resultString)
 
 
-        if (index.isEmpty()) {
+        if (branchAndIndex.isEmpty()) {
             throw GradleException("Failed to find version.")
             throw GradleException("Failed to find version.")
         }
         }
 
 
-        logger.info("Snapshot version index is '$index'")
-        val versionName = "${Versions.project}-$branch-${index}"
+        logger.info("Snapshot version index is '$branchAndIndex'")
+        val versionName = "${Versions.project}-${branchAndIndex}"
 
 
         // Add annotation on GitHub Actions build
         // Add annotation on GitHub Actions build
         // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message
         // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message

+ 1 - 1
ci-release-helper/src/buildIndex/SnapshotVersions.kt

@@ -41,7 +41,7 @@ object GetNextSnapshotIndex {
                 }
                 }
                 println()
                 println()
 
 
-                println("<SNAPSHOT_VERSION_START>${index.value}<SNAPSHOT_VERSION_END>")
+                println("<SNAPSHOT_VERSION_START>$branch-${index.value}<SNAPSHOT_VERSION_END>")
             }
             }
         }
         }
     }
     }