Skip to content

Commit 40d0976

Browse files
committed
Merge branch 'main' into feature/extensionless-urls
2 parents e6f07ca + 100ec31 commit 40d0976

39 files changed

+738
-602
lines changed

.github/workflows/preview-build.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,29 @@ on:
1313
type: string
1414
required: false
1515
default: 'true'
16+
path-pattern:
17+
description: 'Path pattern to filter files. Only if changed files match the pattern, the workflow will continue.'
18+
type: string
19+
default: '**'
20+
required: false
1621

1722
permissions:
1823
contents: read
24+
pull-requests: read
1925

2026
jobs:
2127
build:
2228
runs-on: ubuntu-latest
2329
steps:
30+
31+
- name: Get changed files
32+
id: check-files
33+
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
34+
with:
35+
files: ${{ inputs.path-pattern != '' && inputs.path-pattern || '**' }}
36+
2437
- name: Checkout
38+
if: steps.check-files.outputs.any_changed == 'true'
2539
uses: actions/checkout@v4
2640
with:
2741
persist-credentials: false
@@ -30,11 +44,13 @@ jobs:
3044
env:
3145
PR_NUMBER: ${{ github.event.pull_request.number }}
3246
PR_REF: ${{ github.event.pull_request.head.sha }}
47+
ANY_CHANGED: ${{ steps.check-files.outputs.any_changed }}
3348
run: |
3449
cat << EOF > pull_request.json
3550
{
3651
"number": ${PR_NUMBER},
37-
"ref": "${PR_REF}"
52+
"ref": "${PR_REF}",
53+
"any_changed": ${ANY_CHANGED}
3854
}
3955
EOF
4056
@@ -48,26 +64,28 @@ jobs:
4864
compression-level: 1
4965

5066
- name: Bootstrap Action Workspace
51-
if: github.repository == 'elastic/docs-builder'
67+
if: github.repository == 'elastic/docs-builder' && steps.check-files.outputs.any_changed == 'true'
5268
uses: ./.github/actions/bootstrap
5369

5470
# we run our artifact directly please use the prebuild
5571
# elastic/docs-builder@main GitHub Action for all other repositories!
5672
- name: Build documentation
57-
if: github.repository == 'elastic/docs-builder'
73+
if: github.repository == 'elastic/docs-builder' && steps.check-files.outputs.any_changed == 'true'
5874
env:
5975
PR_NUMBER: ${{ github.event.pull_request.number }}
6076
run: |
6177
dotnet run --project src/docs-builder -- --strict --path-prefix "/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}"
6278
6379
- name: Build documentation
64-
if: github.repository != 'elastic/docs-builder'
80+
if: github.repository != 'elastic/docs-builder' && steps.check-files.outputs.any_changed == 'true'
6581
uses: elastic/docs-builder@main
6682
continue-on-error: ${{ fromJSON(inputs.continue-on-error != '' && inputs.continue-on-error || 'false') }}
6783
with:
6884
prefix: "/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
6985
strict: ${{ fromJSON(inputs.strict != '' && inputs.strict || 'true') }}
86+
7087
- uses: actions/upload-artifact@v4
88+
if: steps.check-files.outputs.any_changed == 'true'
7189
with:
7290
name: docs
7391
path: .artifacts/docs/html/

.github/workflows/preview-cleanup.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@ jobs:
1414
destroy:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: elastic/docs-builder/.github/actions/aws-auth@main
18-
- name: Delete s3 objects
19-
env:
20-
PR_NUMBER: ${{ github.event.pull_request.number }}
21-
run: |
22-
aws s3 rm "s3://elastic-docs-v3-website-preview/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" --recursive
23-
2417
- name: Delete GitHub environment
2518
uses: actions/github-script@v7
19+
id: delete-deployment
2620
with:
2721
script: |
2822
const { owner, repo } = context.repo;
@@ -31,6 +25,7 @@ jobs:
3125
repo,
3226
environment: `docs-preview-${context.issue.number}`
3327
});
28+
core.setOutput('is-empty', deployments.data.length === 0)
3429
for (const deployment of deployments.data) {
3530
await github.rest.repos.createDeploymentStatus({
3631
owner,
@@ -45,3 +40,13 @@ jobs:
4540
deployment_id: deployment.id
4641
});
4742
}
43+
44+
- uses: elastic/docs-builder/.github/actions/aws-auth@main
45+
if: steps.delete-deployment.outputs.is-empty == 'false'
46+
47+
- name: Delete s3 objects
48+
if: steps.delete-deployment.outputs.is-empty == 'false'
49+
env:
50+
PR_NUMBER: ${{ github.event.pull_request.number }}
51+
run: |
52+
aws s3 rm "s3://elastic-docs-v3-website-preview/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" --recursive

.github/workflows/preview-deploy.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ permissions:
1414
actions: read
1515

1616
jobs:
17-
docs-deploy:
17+
pull-request-data:
18+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1819
runs-on: ubuntu-latest
20+
outputs:
21+
number: ${{ steps.pull_request.outputs.number }}
22+
ref: ${{ steps.pull_request.outputs.ref }}
23+
any_changed: ${{ steps.pull_request.outputs.any_changed }}
1924
steps:
2025
- name: Download PR data
2126
env:
@@ -30,14 +35,23 @@ jobs:
3035
{
3136
echo "number=$(jq -r '.number' pull_request.json)"
3237
echo "ref=$(jq -r '.ref' pull_request.json)"
38+
echo "any_changed=$(jq -r '.any_changed' pull_request.json)"
3339
} >> "${GITHUB_OUTPUT}"
34-
40+
41+
deploy:
42+
needs: pull-request-data
43+
if: needs.pull-request-data.outputs.any_changed == 'true'
44+
runs-on: ubuntu-latest
45+
concurrency:
46+
group: ${{ github.workflow }}-${{ needs.pull-request-data.outputs.number }}
47+
cancel-in-progress: true
48+
steps:
3549
- name: Create Deployment
3650
uses: actions/github-script@v7
3751
id: deployment
3852
env:
39-
PR_NUMBER: ${{ steps.pull_request.outputs.number }}
40-
PR_REF: ${{ steps.pull_request.outputs.ref }}
53+
PR_NUMBER: ${{ needs.pull-request-data.outputs.number }}
54+
PR_REF: ${{ needs.pull-request-data.outputs.ref }}
4155
with:
4256
result-encoding: string
4357
script: |
@@ -72,21 +86,23 @@ jobs:
7286

7387
- name: Upload to S3
7488
env:
75-
PR_NUMBER: ${{ steps.pull_request.outputs.number }}
89+
PR_NUMBER: ${{ needs.pull-request-data.outputs.number }}
7690
run: |
7791
aws s3 sync ./html "s3://elastic-docs-v3-website-preview/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" --delete
7892
aws cloudfront create-invalidation --distribution-id EKT7LT5PM8RKS --paths "/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}/*"
7993
8094
- name: Update deployment status
8195
uses: actions/github-script@v7
8296
if: always() && steps.deployment.outputs.result
97+
env:
98+
PR_NUMBER: ${{ needs.pull-request-data.outputs.number }}
8399
with:
84100
script: |
85101
await github.rest.repos.createDeploymentStatus({
86102
owner: context.repo.owner,
87103
repo: context.repo.repo,
88104
deployment_id: ${{ steps.deployment.outputs.result }},
89105
state: "${{ job.status == 'success' && 'success' || 'failure' }}",
90-
environment_url: `https://docs-v3-preview.elastic.dev/${context.repo.owner}/${context.repo.repo}/pull/${{ steps.pull_request.outputs.number}}`,
106+
environment_url: `https://docs-v3-preview.elastic.dev/${context.repo.owner}/${context.repo.repo}/pull/${process.env.PR_NUMBER}`,
91107
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
92108
})

docs/contribute/move.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Move files and folders
2+
3+
When you move a source file or folder, you must also update all inbound and outbound links to reflect the new file location. `docs-builder` provides tooling to handle this step for you.
4+
5+
## `docs-builder mv`
6+
7+
Move a file or folder from one location to another and update all links in the documentation. For example:
8+
9+
```
10+
docs-builder mv ./old-location/ia.md ./new-location/ia.md
11+
```
12+
13+
:::{important}
14+
The `docset.yml` and `toc.yml` files are not automatically updated when using this tool. You must update these references manually.
15+
:::
16+
17+
## `docs-builder mv --help`
18+
19+
```
20+
Usage: mv [arguments...] [options...] [-h|--help] [--version]
21+
22+
Move a file or folder from one location to another and update all links in the documentation
23+
24+
Arguments:
25+
[0] <string?> The source file or folder path to move from
26+
[1] <string?> The target file or folder path to move to
27+
28+
Options:
29+
--dry-run <bool?> Dry run the move operation (Default: null)
30+
-p|--path <string?> Defaults to the`{pwd}` folder (Default: null)
31+
```

docs/docset.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ external_hosts:
1818
- google.com
1919
- checkvist.com
2020
- commonmark.org
21+
- github.io
22+
- github.com
2123
exclude:
2224
- '_*.md'
2325
subs:
@@ -30,6 +32,7 @@ toc:
3032
- file: index.md
3133
- file: locally.md
3234
- file: on-the-web.md
35+
- file: move.md
3336
- folder: migration
3437
children:
3538
- file: index.md
@@ -44,11 +47,11 @@ toc:
4447
- folder: guide
4548
children:
4649
- file: index.md
50+
- file: working-in-docs-content.md
4751
- file: automated.md
4852
- file: tooling.md
49-
- file: bug-bash.md
50-
- file: file-structure.md
5153
- file: mapping.md
54+
- file: how-to-set-up-docs-previews.md
5255
- folder: configure
5356
children:
5457
- file: index.md
@@ -68,10 +71,11 @@ toc:
6871
- folder: syntax
6972
children:
7073
- file: index.md
71-
- file: md-extensions.md
7274
- file: admonitions.md
75+
- file: applies.md
7376
- file: automated_settings.md
7477
- file: code.md
78+
- file: comments.md
7579
- file: conditionals.md
7680
- file: dropdowns.md
7781
- file: example_blocks.md
@@ -81,7 +85,6 @@ toc:
8185
- file: line_breaks.md
8286
- file: links.md
8387
- file: passthrough.md
84-
- file: applies.md
8588
- file: sidebars.md
8689
- file: substitutions.md
8790
- file: sundries.md

docs/migration/engineering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Reference docs guidelines
1+
# New reference guidelines
22

33
## Engineering ownership of reference documentation
44

docs/migration/guide/automated.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Migrate Automated Content to V3
1+
# Migrate automated docs
22

33
If you have automated documentation in Asciidoc (or any other format) that you need to migrate to Elastic docs V3, this guide walks you through the essentials. Elastic docs V3 (powered by `docs-builder`) allows engineering teams to keep code and reference docs closely integrated for easier updates and greater accuracy.
44

@@ -15,8 +15,8 @@ Once you have these files, follow the [Contribute Locally guide](../../contribut
1515

1616
Elastic docs V3 fully supports [CommonMark](https://commonmark.org/) Markdown syntax. In addition, we support:
1717

18-
* Custom directives — our main extension point over markdown (learn more [here](../../syntax/md-extensions.md#directives))
19-
* A few GitHub flavored markdown extensions (see the list [here](../../syntax/md-extensions.md#github-flavored-markdown))
18+
* Custom directives — our main extension point over markdown (learn more [here](../../syntax/index.md))
19+
* A few GitHub flavored markdown extensions (see the list [here](../../syntax/index.md))
2020

2121
In most cases, plain Markdown covers basic needs, and directives add extra functionality as needed.
2222

@@ -43,4 +43,4 @@ For more information, see [Navigation](../../configure/content-set/navigation.md
4343

4444
## Next steps
4545

46-
That’s all you need to get started migrating automated docs to V3. As you add more pages or custom features, refer to the linked resources for details on configuring your docset, refining navigation, and leveraging the full power of V3 directives.
46+
That’s all you need to get started migrating automated docs to V3. As you add more pages or custom features, refer to the linked resources for details on configuring your docset, refining navigation, and leveraging the full power of V3 directives.

docs/migration/guide/bug-bash.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)