Skip to content

Commit 9d82dc5

Browse files
committed
chore(ci): refine Writerside build script formatting and whitespace management
1 parent 0b1201b commit 9d82dc5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

.teamcity/documentation/builds/WritersideBuilder.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,26 @@ abstract class WritersideBuilder(
4040
""".trimIndent()
4141
}
4242
script {
43+
val fileArchive = "webHelp${instance.uppercase()}2.zip"
44+
val buildAssetsNumber = "%dep.${BuildWebHelpFrontend.id ?: throw RuntimeException("BuildWebHelpFrontend.id must not be null")}.build.number%"
45+
4346
id = "post-processing-files"
4447
name = "Post processing files"
4548
workingDir = "artifacts"
4649
// language=bash
4750
scriptContent = """
4851
#!/bin/sh
49-
set -ex
52+
set -e
5053
5154
apk add zip unzip
5255
ls -la
53-
unzip "webHelp${instance.uppercase()}2.zip" -d archive
5456
57+
unzip "$fileArchive" -d archive
5558
cd archive
5659
57-
export ASSET_HASH="%dep.${BuildWebHelpFrontend.id ?: throw RuntimeException("BuildWebHelpFrontend.id must not be null")}.build.number%"
58-
""".trimIndent() + "\n$postProcessAdditions\n" + """
59-
zip -ru ../webHelpKR2.zip .
60+
export ASSET_HASH="$buildAssetsNumber"
61+
""".trimIndent() + "\n\n$postProcessAdditions\n\n" + """
62+
zip -ru "../$fileArchive" .
6063
6164
cd ../ && rm -rf archive
6265
""".trimIndent()
@@ -86,23 +89,20 @@ abstract class WritersideBuilder(
8689
})
8790

8891
// language=sh
89-
fun postProcessingScript() = """
92+
fun postProcessingScript() = "\n" + """
9093
html_files=$(find . -type f -name '*.html')
9194
for file in ${'$'}html_files; do
9295
echo "Processing ${'$'}file"
93-
echo "Fix assets hash #${'$'}ASSET_HASH"
9496
sed -i -E "s/(custom-frontend-app\/[^\"^']+\.(js|css))([\"\'])/\1?${'$'}ASSET_HASH\3/g" "${'$'}file"
9597
96-
echo "Replace old /docs/ urls"
9798
sed -i 's|href="https://kotlinlang.org/docs/|href="/docs/|g' "${'$'}file"
9899
sed -i 's|href="https://www.jetbrains.com/help/kotlin-multiplatform-dev/|href="/docs/multiplatform/|g' "${'$'}file"
99100
done
100101
101102
json_files=$(find . -type f -name '*.json')
102103
for file in ${'$'}json_files; do
103104
echo "Processing ${'$'}file"
104-
echo "Replace old /docs/ urls"
105105
sed -i 's|"url":"https://kotlinlang.org/docs/|"url": "/docs/|g' "${'$'}file"
106106
sed -i 's|"url":"https://www.jetbrains.com/help/kotlin-multiplatform-dev/|"url": "/docs/multiplatform/|g' "${'$'}file"
107107
done
108-
""".trimIndent()
108+
""".trimIndent() + "\n"

0 commit comments

Comments
 (0)