[build] Use snapshot version from build index

This commit is contained in:
Him188 2023-03-21 16:29:33 +00:00
parent e3891c0388
commit 77132eee41
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
2 changed files with 6 additions and 6 deletions

View File

@ -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'") logger.info("Snapshot version index is '$branchAndIndex'")
val versionName = "${Versions.project}-$branch-${index}" 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

View File

@ -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>")
} }
} }
} }