Skip to content

Commit 66367e2

Browse files
committed
chore(docs): add post-processing script step to Writerside build configuration
1 parent 8f080f0 commit 66367e2

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.teamcity/documentation/builds/WritersideBuilder.kt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package documentation.builds
22

3+
import jetbrains.buildServer.configs.kotlin.ArtifactDependency
34
import jetbrains.buildServer.configs.kotlin.BuildType
5+
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
46
import jetbrains.buildServer.configs.kotlin.buildSteps.script
57
import kotlinlang.builds.BuildWebHelpFrontend
68

@@ -11,6 +13,7 @@ abstract class WritersideBuilder(
1113
): BuildType({
1214
val dockerImageTag = "2025.07.8502"
1315
val frontend = "file:///opt/static/"
16+
val output_dir = "/opt/sources/artifacts"
1417

1518
name = "${instance.uppercase()} documentation build"
1619
description = "Build $module/$instance documentation with the docker"
@@ -34,9 +37,31 @@ abstract class WritersideBuilder(
3437
-e MODULE_INSTANCE=$module/$instance
3538
-e RUNNER=teamcity
3639
-e FRONTEND=$frontend
37-
-e OUTPUT_DIR=/opt/sources/artifacts
40+
-e OUTPUT_DIR=$output_dir
3841
""".trimIndent()
3942
}
43+
script {
44+
name = "Post processing files"
45+
workingDir = "artifacts"
46+
// language=bash
47+
scriptContent = """
48+
#!/bin/bash
49+
set -ex
50+
51+
export ASSET_HASH="%dep.${BuildWebHelpFrontend.id ?: throw RuntimeException("BuildWebHelpFrontend.id must not be null")}.build.number%"
52+
53+
echo "Iterate over html files"
54+
html_files=$(find . -type f -name '*.html')
55+
for file in ${'$'}html_files; do
56+
echo "Processing ${'$'}file"
57+
echo "Fix assets hash ${'$'}ASSET_HASH"
58+
sed -E "s/(custom-frontend-app\/[^\"^']+\.(js|css))([\"\'])/\1?${'$'}ASSET_HASH\3/g" "${'$'}file"
59+
done
60+
""".trimIndent()
61+
62+
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
63+
dockerImage = "alpine:latest"
64+
}
4065
}
4166

4267
requirements {

0 commit comments

Comments
 (0)