Skip to content

Commit 7ab4b2a

Browse files
pqcj-radcliff
authored andcommitted
[friction] support for local dev-channel deploy (#340)
1 parent db50ed5 commit 7ab4b2a

2 files changed

Lines changed: 33 additions & 10 deletions

File tree

third_party/build.gradle.kts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ intellijPlatform {
4545
val datestamp = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now())
4646
val baseVersion = "$nextMajorVersion.0.0-dev.$datestamp"
4747

48-
val commitHash = System.getenv("KOKORO_GIT_COMMIT")
49-
version = if (commitHash != null) "$baseVersion-${commitHash.take(7)}" else baseVersion
48+
val commitHash = System.getenv("KOKORO_GIT_COMMIT") ?: try {
49+
providers.exec {
50+
commandLine("git", "rev-parse", "--short", "HEAD")
51+
}.standardOutput.asText.get().trim()
52+
} catch (e: Exception) {
53+
""
54+
}
55+
version = if (commitHash.isNotEmpty()) "$baseVersion-${commitHash.take(7)}" else baseVersion
5056
} else {
5157
version = providers.gradleProperty("pluginVersion")
5258
}
@@ -253,8 +259,16 @@ tasks.register("printCompileClasspath") {
253259
}
254260
}
255261

256-
tasks.register("printVersion") {
257-
doLast {
258-
println(intellijPlatform.pluginConfiguration.version.get())
262+
abstract class PrintVersionTask : org.gradle.api.DefaultTask() {
263+
@get:org.gradle.api.tasks.Input
264+
abstract val pluginVersion: org.gradle.api.provider.Property<String>
265+
266+
@org.gradle.api.tasks.TaskAction
267+
fun action() {
268+
println(pluginVersion.get())
259269
}
260270
}
271+
272+
tasks.register<PrintVersionTask>("printVersion") {
273+
pluginVersion.set(intellijPlatform.pluginConfiguration.version)
274+
}

third_party/tool/kokoro/deploy.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# To run this script locally from the repository root:
4+
# JB_MARKETPLACE_TOKEN="your_real_token" ./third_party/tool/kokoro/deploy.sh
5+
36
source ./third_party/tool/kokoro/setup.sh
47
setup
58

@@ -18,12 +21,18 @@ echo "kokoro deploy start"
1821
DART_KEYSTORE_ID=74840
1922
DART_KEYSTORE_NAME=jetbrains-plugin-upload-auth-token
2023

21-
KOKORO_TOKEN_FILE="${KOKORO_KEYSTORE_DIR}/${DART_KEYSTORE_ID}_${DART_KEYSTORE_NAME}"
22-
if [ ! -f "$KOKORO_TOKEN_FILE" ]; then
23-
echo "Error: Keystore token file not found at $KOKORO_TOKEN_FILE"
24-
exit 1
24+
if [ -n "$JB_MARKETPLACE_TOKEN" ]; then
25+
TOKEN="$JB_MARKETPLACE_TOKEN"
26+
echo "Using token from JB_MARKETPLACE_TOKEN environment variable."
27+
else
28+
KOKORO_TOKEN_FILE="${KOKORO_KEYSTORE_DIR}/${DART_KEYSTORE_ID}_${DART_KEYSTORE_NAME}"
29+
if [ ! -f "$KOKORO_TOKEN_FILE" ]; then
30+
echo "Error: Keystore token file not found at $KOKORO_TOKEN_FILE"
31+
echo "Please set JB_MARKETPLACE_TOKEN or ensure KOKORO_KEYSTORE_DIR is set correctly."
32+
exit 1
33+
fi
34+
TOKEN=$(cat "$KOKORO_TOKEN_FILE")
2535
fi
26-
TOKEN=$(cat "$KOKORO_TOKEN_FILE")
2736

2837
ZIP_FILE="build/distributions/Dart.zip"
2938
if [ ! -f "$ZIP_FILE" ]; then

0 commit comments

Comments
 (0)