Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15e6ee5
Allow limited public assembler builds on docs-builder
cotti Dec 17, 2025
fc05e7e
Use path prefix for llms.txt when available
cotti Dec 17, 2025
3b228a0
Adjust link-index.snapshot generation with path prefixes
cotti Dec 17, 2025
4ca1805
Adjust sitemap.xml generation to use path prefixes when available.
cotti Dec 17, 2025
ed133bf
Remove extra slash
cotti Dec 17, 2025
71dbdaf
Create assembler deployment process
cotti Dec 17, 2025
ebf0abb
Apply automated fix to 'Call to System.IO.Path.Combine'
cotti Dec 17, 2025
31f208e
Apply remaining updates
cotti Dec 17, 2025
f46f699
Move the assembler preview to a separate workflow
cotti Dec 18, 2025
76643cb
Merge branch 'main' into feature/db-assembler-previews
cotti Dec 18, 2025
9fed4a8
Revert "Move the assembler preview to a separate workflow"
cotti Dec 18, 2025
2fd9d4f
Revert "Create assembler deployment process"
cotti Dec 18, 2025
baf4c87
Revert "Remove extra slash"
cotti Dec 18, 2025
1b3dcaf
Revert "Allow limited public assembler builds on docs-builder"
cotti Dec 18, 2025
7d6b125
Merge remote-tracking branch 'origin/feature/db-assembler-previews' i…
cotti Dec 18, 2025
38a1160
Add workflow
cotti Dec 22, 2025
11a183a
Remove label execution
cotti Dec 22, 2025
70d1290
Merge branch 'main' into feature/db-assembler-previews
cotti Dec 22, 2025
eb54ed8
Add labeled clause
cotti Dec 22, 2025
13479f0
Merge remote-tracking branch 'origin/feature/db-assembler-previews' i…
cotti Dec 22, 2025
d43f146
Fix SHA evalutation on PRs
cotti Dec 22, 2025
929efdd
Un-revert assembler preview config
cotti Dec 22, 2025
a81cde5
Simplify usage of path-prefixed output
cotti Dec 22, 2025
c82d89c
Add suggested change to 'Call to System.IO.Path.Combine'
cotti Dec 22, 2025
cb2556e
Re-consolidate PR Details step, set path_prefix at job level
cotti Dec 23, 2025
7d73c67
Add cleanup workflow
cotti Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- opened
- synchronize
- reopened
- labeled
push:
branches:
- main
Expand Down Expand Up @@ -516,6 +517,81 @@ jobs:
environment_url: `https://docs-v3-preview.elastic.dev${process.env.LANDING_PAGE_PATH}`,
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
})

- name: Create Assembler Deployment
if: >
github.repository == 'elastic/docs-builder'
&& steps.deployment.outputs.result
&& contains(github.event.pull_request.labels.*.name, 'assembler-preview')
uses: actions/github-script@v8
id: assembler-deployment
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
REF: ${{ github.event.pull_request.head.sha }}
with:
result-encoding: string
script: |
const { owner, repo } = context.repo;
const prNumber = process.env.PR_NUMBER;
const environment = 'assembler-preview';
const task = `assembler-preview-${prNumber}`;
const deployment = await github.rest.repos.createDeployment({
owner,
repo,
environment,
task,
ref: process.env.REF,
auto_merge: false,
transient_environment: true,
required_contexts: [],
})
await github.rest.repos.createDeploymentStatus({
deployment_id: deployment.data.id,
owner,
repo,
state: "in_progress",
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
})
return deployment.data.id

- name: Build assembled documentation
id: internal-assembler-build
if: steps.assembler-deployment.outputs.result
env:
ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/assembled-docs/${{ github.event.pull_request.number }}
run: |
yq -i ".environments.preview.path_prefix = \"${ASSEMBLER_PREVIEW_PATH_PREFIX}\"" config/assembler.yml
dotnet run --project src/tooling/docs-builder -- assemble --skip-private-repositories --environment preview

- name: Upload assembled docs to S3
id: assembler-s3-upload
if: steps.internal-assembler-build.outcome == 'success'
env:
AWS_RETRY_MODE: standard
AWS_MAX_ATTEMPTS: 6
ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/assembled-docs/${{ github.event.pull_request.number }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/assembled-docs/${{ github.event.pull_request.number }}
ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/docs/${{ github.event.pull_request.number }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

run: |
aws s3 sync .artifacts/assembly/${ASSEMBLER_PREVIEW_PATH_PREFIX} "s3://elastic-docs-v3-website-preview/${ASSEMBLER_PREVIEW_PATH_PREFIX}" --delete --no-follow-symlinks
aws cloudfront create-invalidation \
--distribution-id EKT7LT5PM8RKS \
--paths "/${ASSEMBLER_PREVIEW_PATH_PREFIX}" "/${ASSEMBLER_PREVIEW_PATH_PREFIX}/*"

- name: Update Assembler Deployment Status
if: always() && steps.assembler-deployment.outputs.result
uses: actions/github-script@v8
env:
ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/assembled-docs/${{ github.event.pull_request.number }}
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.assembler-deployment.outputs.result || 0 }},
state: "${{ steps.assembler-s3-upload.outcome == 'success' && 'success' || 'failure' }}",
environment_url: `https://docs-v3-preview.elastic.dev/${process.env.ASSEMBLER_PREVIEW_PATH_PREFIX}`,
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
})

comment:
if: >
startsWith(github.event_name, 'pull_request')
Expand Down
8 changes: 8 additions & 0 deletions config/assembler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ environments:
path_prefix: docs
feature_flags:
SEARCH_OR_ASK_AI: true
preview:
uri: https://docs-v3-preview.elastic.dev
path_prefix: ${ASSEMBLER_PREVIEW_PATH_PREFIX}
content_source: current
google_tag_manager:
enabled: false
feature_flags:
SEARCH_OR_ASK_AI: true

shared_configuration:
stack: &stack
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/Exporters/LlmMarkdownExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class LlmMarkdownExporter : IMarkdownExporter

public async ValueTask<bool> FinishExportAsync(IDirectoryInfo outputFolder, Cancel ctx)
{
var outputDirectory = Path.Combine(outputFolder.FullName, "docs");
var outputDirectory = outputFolder.FullName;
var zipPath = Path.Combine(outputDirectory, "llm.zip");

// Create the llms.txt file with boilerplate content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ Cancel ctx

if (exporters.Contains(Exporter.Html))
{
var sitemapBuilder = new SitemapBuilder(navigation.NavigationItems, assembleContext.WriteFileSystem, assembleContext.OutputDirectory);
var pathPrefix = assembleContext.Environment.PathPrefix;
var outputWithPrefix = string.IsNullOrEmpty(pathPrefix)
? assembleContext.OutputDirectory
: assembleContext.WriteFileSystem.DirectoryInfo.New(assembleContext.WriteFileSystem.Path.Combine(assembleContext.OutputDirectory.FullName, pathPrefix));
var sitemapBuilder = new SitemapBuilder(navigation.NavigationItems, assembleContext.WriteFileSystem, outputWithPrefix);
sitemapBuilder.Generate();
}

Expand All @@ -140,9 +144,10 @@ Cancel ctx

private static async Task EnhanceLlmsTxtFile(AssembleContext context, SiteNavigation navigation, LlmsNavigationEnhancer enhancer, Cancel ctx)
{
var llmsTxtPath = Path.Combine(context.OutputDirectory.FullName, "docs", "llms.txt");

var readFs = context.ReadFileSystem;
var pathPrefix = context.Environment.PathPrefix ?? "docs";
var llmsTxtPath = readFs.Path.Combine(context.OutputDirectory.FullName, pathPrefix, "llms.txt");

if (!readFs.File.Exists(llmsTxtPath))
return; // No llms.txt file to enhance

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ public async Task BuildAllAsync(PublishEnvironment environment, FrozenDictionary
foreach (var exporter in markdownExporters)
{
_logger.LogInformation("Calling FinishExportAsync on {ExporterName}", exporter.GetType().Name);
_ = await exporter.FinishExportAsync(context.OutputDirectory, ctx);
var pathPrefix = context.Environment.PathPrefix;
var outputWithPrefix = string.IsNullOrEmpty(pathPrefix)
? context.OutputDirectory
: context.ReadFileSystem.DirectoryInfo.New(Path.Join(context.OutputDirectory.FullName, pathPrefix));
_ = await exporter.FinishExportAsync(outputWithPrefix, ctx);
}

if (exportOptions.Contains(Exporter.Redirects))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void Generate()

doc.Add(root);

using var fileStream = fileSystem.File.Create(Path.Combine(outputFolder.ToString() ?? string.Empty, "docs", "sitemap.xml"));
using var fileStream = fileSystem.File.Create(fileSystem.Path.Combine(outputFolder.FullName, "sitemap.xml"));
doc.Save(fileStream);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ await context.WriteFileSystem.File.WriteAllTextAsync(
};
}

public async Task WriteLinkRegistrySnapshot(LinkRegistry linkRegistrySnapshot, Cancel ctx = default) => await context.WriteFileSystem.File.WriteAllTextAsync(
Path.Combine(context.OutputDirectory.FullName, "docs", CheckoutResult.LinkRegistrySnapshotFileName),
public async Task WriteLinkRegistrySnapshot(LinkRegistry linkRegistrySnapshot, Cancel ctx = default)
{
var pathPrefix = context.Environment.PathPrefix ?? "docs";
await context.WriteFileSystem.File.WriteAllTextAsync(
context.WriteFileSystem.Path.Combine(context.OutputDirectory.FullName, pathPrefix, CheckoutResult.LinkRegistrySnapshotFileName),
LinkRegistry.Serialize(linkRegistrySnapshot),
ctx
);
}
}


Expand Down
Loading