Skip to content

Commit 8e4b8d3

Browse files
committed
Merge branch 'main' into feature/index-documents
2 parents 36c4df9 + da2667b commit 8e4b8d3

File tree

54 files changed

+1960
-1415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1960
-1415
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ updates:
1616
interval: 'weekly'
1717
day: 'monday'
1818
time: '08:00'
19+
groups:
20+
tailwindcss:
21+
patterns:
22+
- 'tailwindcss'
23+
- '@tailwindcss/postcss'
24+
- 'prettier-plugin-tailwindcss'
1925
labels:
2026
- chore
2127
- package-ecosystem: nuget

.github/workflows/pr.yml renamed to .github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: PR
1+
name: ci
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request:
58

69
permissions:
@@ -14,7 +17,7 @@ env:
1417
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
1518

1619
jobs:
17-
validate-navigation:
20+
validate-assembler:
1821
runs-on: ubuntu-latest
1922
steps:
2023
- uses: actions/checkout@v4
@@ -23,9 +26,12 @@ jobs:
2326
id: bootstrap
2427
uses: ./.github/actions/bootstrap
2528

26-
- name: Build
29+
- name: Validate Navigation
2730
run: dotnet run --project src/tooling/docs-assembler -c release -- navigation validate
2831

32+
- name: Validate Content Sources
33+
run: dotnet run --project src/tooling/docs-assembler -c release -- content-source validate
34+
2935
build-lambda:
3036
uses: ./.github/workflows/build-link-index-updater-lambda.yml
3137

.github/workflows/preview-build.yml

Lines changed: 87 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ on:
1010
branches:
1111
- main
1212
- master
13+
# TODO remove these need to be added to individual repositories
14+
- '\d+.\d+.\d+'
15+
- '\d+.\d+'
16+
- '\d+.x'
17+
tags:
18+
- 'v?\d+.\d+.\d+'
19+
- 'v?\d+.\d+'
1320
workflow_call:
1421
inputs:
1522
strict:
@@ -44,6 +51,44 @@ permissions:
4451
pull-requests: read
4552

4653
jobs:
54+
match:
55+
if: github.event.repository.fork == false # Skip running the job on the fork itself (It still runs on PRs on the upstream from forks)
56+
concurrency:
57+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref }}
58+
cancel-in-progress: ${{ startsWith(github.event_name, 'pull_request') }}
59+
runs-on: ubuntu-latest
60+
outputs:
61+
content-source-match: ${{ steps.event-check.outputs.content-source-match != '' && steps.event-check.outputs.content-source-match || steps.match.outputs.content-source-match }}
62+
content-source-next: ${{ steps.event-check.outputs.content-source-next != '' && steps.event-check.outputs.content-source-next || steps.match.outputs.content-source-next }}
63+
content-source-current: ${{ steps.event-check.outputs.content-source-current != '' && steps.event-check.outputs.content-source-current || steps.match.outputs.content-source-current }}
64+
content-source-speculative: ${{ steps.event-check.outputs.content-source-speculative != '' && steps.event-check.outputs.content-source-speculative || steps.match.outputs.content-source-speculative }}
65+
steps:
66+
- name: Not a push event
67+
id: event-check
68+
if: contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name)
69+
# we always want to run for pull requests, but we do not want to indicate its either content source
70+
run: |
71+
echo "content-source-match=true" >> $GITHUB_OUTPUT
72+
echo "content-source-next=false" >> $GITHUB_OUTPUT
73+
echo "content-source-current=false" >> $GITHUB_OUTPUT
74+
echo "content-source-speculative=false" >> $GITHUB_OUTPUT
75+
- name: Match for push events
76+
id: match
77+
if: contains(fromJSON('["push"]'), github.event_name)
78+
uses: elastic/docs-builder/actions/assembler-match@main
79+
with:
80+
ref_name: ${{ github.ref_name }}
81+
repository: ${{ github.repository }}
82+
- name: Debug
83+
run: |
84+
echo "Non sensitive data, echo'ing here temporarily to validate this job before connecting it further into the build job"
85+
echo "content-source-match=${{ steps.event-check.outputs.content-source-match != '' && steps.event-check.outputs.content-source-match || steps.match.outputs.content-source-match }}"
86+
echo "content-source-next=${{ steps.event-check.outputs.content-source-next != '' && steps.event-check.outputs.content-source-next || steps.match.outputs.content-source-next }}"
87+
echo "content-source-current=${{ steps.event-check.outputs.content-source-current != '' && steps.event-check.outputs.content-source-current || steps.match.outputs.content-source-current }}"
88+
echo "content-source-speculative=${{ steps.event-check.outputs.content-source-speculative != '' && steps.event-check.outputs.content-source-speculative || steps.match.outputs.content-source-speculative }}"
89+
echo "ref=${{ github.ref_name }}"
90+
echo "repo=${{ github.repository }}"
91+
4792
build:
4893
if: github.event.repository.fork == false # Skip running the job on the fork itself (It still runs on PRs on the upstream from forks)
4994
concurrency:
@@ -52,30 +97,36 @@ jobs:
5297
runs-on: ubuntu-latest
5398
env:
5499
GITHUB_PR_REF_NAME: ${{ github.event.pull_request.head.ref }}
100+
MATCH: ${{ needs.match.outputs.content-source-match }}
101+
needs: [ match ]
55102
steps:
56103

57104
- name: Checkout
58-
if: contains(fromJSON('["push", "merge_group", "workflow_dispatch"]'), github.event_name)
105+
if: env.MATCH == 'true' && (contains(fromJSON('["push", "merge_group", "workflow_dispatch"]'), github.event_name))
59106
uses: actions/checkout@v4
60107
with:
61108
ref: ${{ github.event.pull_request.head.sha || github.ref }}
62109

63110
- name: Get changed files
64-
if: contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name)
111+
if: env.MATCH == 'true' && (contains(fromJSON('["merge_group", "pull_request", "pull_request_target"]'), github.event_name))
65112
id: check-files
66113
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
67114
with:
68115
files: ${{ inputs.path-pattern != '' && inputs.path-pattern || '**' }}
69116

70117
- name: Checkout
71-
if: startsWith(github.event_name, 'pull_request') && steps.check-files.outputs.any_modified == 'true'
118+
if: env.MATCH == 'true' && (startsWith(github.event_name, 'pull_request') && steps.check-files.outputs.any_modified == 'true')
72119
uses: actions/checkout@v4
73120
with:
74121
ref: ${{ github.event.pull_request.head.sha || github.ref }}
75122
persist-credentials: false
76123

77124
- name: Create Deployment
78-
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) || (steps.check-files.outputs.any_modified == 'true' && startsWith(github.event_name, 'pull_request'))
125+
if: |
126+
env.MATCH == 'true' &&
127+
(contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
128+
|| (steps.check-files.outputs.any_modified == 'true' && startsWith(github.event_name, 'pull_request'))
129+
)
79130
uses: actions/github-script@v7
80131
id: deployment
81132
env:
@@ -108,7 +159,7 @@ jobs:
108159
return deployment.data.id
109160
110161
- name: Generate env.PATH_PREFIX
111-
if: steps.deployment.outputs.result
162+
if: env.MATCH == 'true' && (steps.deployment.outputs.result)
112163
env:
113164
PR_NUMBER: ${{ github.event.pull_request.number }}
114165
GITHUB_REF_NAME: ${{ github.ref_name }}
@@ -119,10 +170,6 @@ jobs:
119170
;;
120171
"push" | "workflow_dispatch")
121172
echo "PATH_PREFIX=/${GITHUB_REPOSITORY}/tree/${GITHUB_REF_NAME}" >> $GITHUB_ENV
122-
if [[ ! "${GITHUB_REF_NAME}" =~ ^(main|master|16\.x)$ ]]; then
123-
echo "Unsupported ref name: '${GITHUB_REF_NAME}'";
124-
exit 1;
125-
fi
126173
;;
127174
*)
128175
echo "Unsupported event: '${GITHUB_EVENT_NAME}'";
@@ -131,18 +178,22 @@ jobs:
131178
esac
132179
133180
- name: Bootstrap Action Workspace
134-
if: github.repository == 'elastic/docs-builder' && steps.deployment.outputs.result
181+
if: env.MATCH == 'true' && (github.repository == 'elastic/docs-builder' && steps.deployment.outputs.result)
135182
uses: elastic/docs-builder/.github/actions/bootstrap@main
136183

137-
# we run our artifact directly please use the prebuild
184+
# we run our artifact directly, please use the prebuild
138185
# elastic/docs-builder@main GitHub Action for all other repositories!
139186
- name: Build documentation
140-
if: github.repository == 'elastic/docs-builder' && steps.deployment.outputs.result
187+
if: env.MATCH == 'true' && (github.repository == 'elastic/docs-builder' && steps.deployment.outputs.result)
141188
run: |
142189
dotnet run --project src/tooling/docs-builder -- --strict --path-prefix "${PATH_PREFIX}"
143190
144191
- name: Build documentation
145-
if: github.repository != 'elastic/docs-builder' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group'))
192+
if: |
193+
env.MATCH == 'true' &&
194+
(github.repository != 'elastic/docs-builder' &&
195+
(steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group'))
196+
)
146197
uses: elastic/docs-builder@main
147198
id: docs-build
148199
continue-on-error: ${{ fromJSON(inputs.continue-on-error != '' && inputs.continue-on-error || 'false') }}
@@ -152,32 +203,50 @@ jobs:
152203
metadata-only: ${{ fromJSON(inputs.metadata-only != '' && inputs.metadata-only || 'true') }}
153204

154205
- name: 'Validate inbound links'
155-
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group')) }}
206+
if: |
207+
env.MATCH == 'true' &&
208+
(!cancelled() && steps.docs-build.outputs.skip != 'true'
209+
&& (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group'))
210+
)
156211
uses: elastic/docs-builder/actions/validate-inbound-local@main
157212

158213
- name: 'Validate local path prefixes against those claimed by global navigation.yml'
159-
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group')) }}
214+
if: |
215+
env.MATCH == 'true' &&
216+
(!cancelled() && steps.docs-build.outputs.skip != 'true' &&
217+
(steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group'))
218+
)
160219
uses: elastic/docs-builder/actions/validate-path-prefixes-local@main
161220

162221
- uses: elastic/docs-builder/.github/actions/aws-auth@main
163222
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && steps.deployment.outputs.result }}
164223

165224
- name: Upload to S3
166225
id: s3-upload
167-
if: ${{ !cancelled() && steps.docs-build.outputs.skip != 'true' && steps.deployment.outputs.result }}
226+
if: |
227+
env.MATCH == 'true' &&
228+
(!cancelled() && steps.docs-build.outputs.skip != 'true' && steps.deployment.outputs.result)
168229
run: |
169230
aws s3 sync .artifacts/docs/html "s3://elastic-docs-v3-website-preview${PATH_PREFIX}" --delete --no-follow-symlinks
170231
aws cloudfront create-invalidation \
171232
--distribution-id EKT7LT5PM8RKS \
172233
--paths "${PATH_PREFIX}" "${PATH_PREFIX}/*"
173234
174235
- name: Update Link Index
175-
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && steps.s3-upload.outcome == 'success'
236+
if: |
237+
env.MATCH == 'true' &&
238+
(contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
239+
&& (
240+
needs.match.outputs.content-source-current == 'true'
241+
|| needs.match.outputs.content-source-next == 'true'
242+
|| needs.match.outputs.content-source-speculative == 'true'
243+
)
244+
&& steps.s3-upload.outcome == 'success')
176245
uses: elastic/docs-builder/actions/update-link-index@main
177246

178247
- name: Update deployment status
179248
uses: actions/github-script@v7
180-
if: always() && steps.deployment.outputs.result
249+
if: env.MATCH == 'true' && (always() && steps.deployment.outputs.result)
181250
env:
182251
PR_NUMBER: ${{ github.event.pull_request.number }}
183252
LANDING_PAGE_PATH: ${{ steps.docs-build.outputs.landing-page-path || env.PATH_PREFIX }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.13.1
1+
22.16.0

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# docs-builder
22

3+
[![ci](https://github.com/elastic/docs-builder/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/elastic/docs-builder/actions/workflows/ci.yml)
4+
35
You've reached the home of the latest incarnation of the documentation tooling.
46

57
This repository is host to:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'Documentation Assembler Configuration Validator'
2+
description: 'Ensures the assembler configuration is valid'
3+
4+
branding:
5+
icon: 'filter'
6+
color: 'blue'
7+
8+
runs:
9+
using: 'docker'
10+
image: "docker://ghcr.io/elastic/docs-assembler:edge"
11+
env:
12+
INPUT_COMMAND: "content-source validate"

actions/assembler-match/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ inputs:
1616
outputs:
1717
content-source-match:
1818
description: 'true/false indicating the branch matches a content-source'
19-
content-source-name:
20-
description: "The name of the content source that matches (current/next) or empty"
19+
content-source-next:
20+
description: "true/false indicating the branch acts as the next content source"
21+
content-source-current:
22+
description: "true/false indicating the branch acts as the current content source"
23+
content-source-speculative:
24+
description: "true/false speculative match, used to build version branches before they are marked as current/next"
2125

2226
runs:
2327
using: 'docker'

build/Targets.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let private version _ =
3434

3535
let private format _ = exec { run "dotnet" "format" "--verbosity" "quiet" }
3636

37-
let private watch _ = exec { run "dotnet" "watch" "--project" "src/docs-builder" "--no-hot-reload" "--" "serve" }
37+
let private watch _ = exec { run "dotnet" "watch" "--project" "src/tooling/docs-builder" "--no-hot-reload" "--" "serve" }
3838

3939
let private lint _ =
4040
match exec {
@@ -164,4 +164,4 @@ let Setup (parsed:ParseResults<Build>) =
164164

165165
for target in Build.Targets do
166166
let setup = wireCommandLine target
167-
setup target parsed
167+
setup target parsed

docs-builder.sln

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tooling", "tooling", "{73AB
8989
EndProject
9090
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "authoring", "authoring", "{059E787F-85C1-43BE-9DD6-CE319E106383}"
9191
EndProject
92-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assembler-filter", "assembler-filter", "{FB1C1954-D8E2-4745-BA62-04DD82FB4792}"
92+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assembler-match", "assembler-match", "{FB1C1954-D8E2-4745-BA62-04DD82FB4792}"
9393
ProjectSection(SolutionItems) = preProject
94-
actions\assembler-filter\action.yml = actions\assembler-filter\action.yml
94+
actions\assembler-match\action.yml = actions\assembler-match\action.yml
9595
EndProjectSection
9696
EndProject
97+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assembler-config-validate", "assembler-config-validate", "{E20FEEF9-1D1A-4CDA-A546-7FDC573BE399}"
98+
ProjectSection(SolutionItems) = preProject
99+
actions\assembler-config-validate\action.yml = actions\assembler-config-validate\action.yml
100+
EndProjectSection
101+
EndProject
102+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.LinkIndex", "src\Elastic.Documentation.LinkIndex\Elastic.Documentation.LinkIndex.csproj", "{FD1AC230-798B-4AB9-8CE6-A06264885DBC}"
103+
EndProject
97104
Global
98105
GlobalSection(SolutionConfigurationPlatforms) = preSolution
99106
Debug|Any CPU = Debug|Any CPU
@@ -155,6 +162,10 @@ Global
155162
{CD94F9E4-7FCD-4152-81F1-4288C6B75367}.Debug|Any CPU.Build.0 = Debug|Any CPU
156163
{CD94F9E4-7FCD-4152-81F1-4288C6B75367}.Release|Any CPU.ActiveCfg = Release|Any CPU
157164
{CD94F9E4-7FCD-4152-81F1-4288C6B75367}.Release|Any CPU.Build.0 = Release|Any CPU
165+
{FD1AC230-798B-4AB9-8CE6-A06264885DBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
166+
{FD1AC230-798B-4AB9-8CE6-A06264885DBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
167+
{FD1AC230-798B-4AB9-8CE6-A06264885DBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
168+
{FD1AC230-798B-4AB9-8CE6-A06264885DBC}.Release|Any CPU.Build.0 = Release|Any CPU
158169
EndGlobalSection
159170
GlobalSection(NestedProjects) = preSolution
160171
{4D198E25-C211-41DC-9E84-B15E89BD7048} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
@@ -178,5 +189,7 @@ Global
178189
{059E787F-85C1-43BE-9DD6-CE319E106383} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
179190
{7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166} = {059E787F-85C1-43BE-9DD6-CE319E106383}
180191
{FB1C1954-D8E2-4745-BA62-04DD82FB4792} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7}
192+
{E20FEEF9-1D1A-4CDA-A546-7FDC573BE399} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7}
193+
{FD1AC230-798B-4AB9-8CE6-A06264885DBC} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
181194
EndGlobalSection
182195
EndGlobal

docs/contribute/locally.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ This guide uses the first option. If you'd like to clone the repository and buil
4444

4545
2. **Run docs-builder from a docs folder**
4646

47-
Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`:
47+
Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000:
4848

4949
```sh
5050
docs-builder serve
5151
```
52+
The path to the `docset.yml` file that you want to build can be specified with `-p`.
5253

5354
To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub.
5455

@@ -72,12 +73,12 @@ If you get a `Permission denied` error, make sure that you aren't trying to run
7273

7374
2. **Run docs-builder from a docs folder**
7475

75-
Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`:
76+
Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000:
7677

7778
```sh
7879
docs-builder serve
7980
```
80-
81+
The path to the `docset.yml` file that you want to build can be specified with `-p`.
8182
:::
8283
::::
8384

@@ -111,7 +112,7 @@ cd docs-content
111112

112113
:::::{step} Run docs-builder
113114

114-
Run the `docs-builder` binary with the `serve` command to build and serve the content set to http://localhost:3000. Specify the path to the `docset.yml` file that you want to build with `-p`.
115+
Run the `docs-builder` binary with the `serve` command to build and serve the content set to http://localhost:3000. If necessary, specify the path to the `docset.yml` file that you want to build with `-p`.
115116

116117
For example:
117118

0 commit comments

Comments
 (0)