Docs: build perfetto.dev with JS and add autopush
This CL achieves two goals:
1. Rewrites the build rules for the docs site using
a custom JS script, similar to what we did recently
for ui.perfetto.dev. This makes testing local docs
changes easier. Previously it required the cloud SDK
and caused problems to many devs.
2. Allows autopushing via Cloud Build, using the same
plan of go/perfetto-ui-autopush.
Bug: 179864115
Change-Id: I28906d18b3591a0e94f31e6c16ce15710be851c1
diff --git a/infra/perfetto.dev/src/markdown_render.js b/infra/perfetto.dev/src/markdown_render.js
index ebb34d8..4bad17b 100644
--- a/infra/perfetto.dev/src/markdown_render.js
+++ b/infra/perfetto.dev/src/markdown_render.js
@@ -200,7 +200,7 @@
const templateData = {
markdown: markdownHtml,
title: title ? `${title} - Perfetto Tracing Docs` : fallbackTitle,
- fileName: '/' + outFile.split('/').slice(1).join('/'),
+ fileName: '/' + path.relative(outDir, outFile),
};
if (fs.existsSync(navFilePath)) {
templateData['nav'] = fs.readFileSync(navFilePath, 'utf8');