Skip to content

Commit 95c10c4

Browse files
committed
Test transient
1 parent 2587fa9 commit 95c10c4

File tree

2 files changed

+14
-46
lines changed

2 files changed

+14
-46
lines changed

.github/workflows/preview-build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
if: github.event_name == 'push' || steps.check-files.outputs.any_changed == 'true'
5454
uses: actions/checkout@v4
5555
with:
56+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
5657
persist-credentials: false
5758

5859
- name: Create Deployment
@@ -67,13 +68,15 @@ jobs:
6768
script: |
6869
const { owner, repo } = context.repo;
6970
const prNumber = process.env.PR_NUMBER;
70-
const environment = prNumber ? `docs-preview-${prNumber}` : 'docs-preview';
71+
// const environment = prNumber ? `docs-preview-${prNumber}` : 'docs-preview';
72+
const environment = 'docs-preview';
7173
const deployment = await github.rest.repos.createDeployment({
7274
owner,
7375
repo,
7476
environment,
7577
ref: process.env.REF,
7678
auto_merge: false,
79+
transient_environment: true,
7780
required_contexts: [],
7881
})
7982
await github.rest.repos.createDeploymentStatus({

docs/migration/guide/how-to-set-up-docs-previews.md

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ This guide will help you set up docs previews for your GitHub repository.
44

55
## GitHub Workflows
66

7-
The docs preview system consists of three GitHub Workflows:
7+
The docs preview system consists of two GitHub Workflows:
88
- [`docs-build.yml`](#build): **Build** the docs on a PR
9-
- [`docs-deploy.yml`](#deploy): **Deploy** the docs to our preview environment
109
- [`docs-cleanup.yml`](#cleanup): **Cleanup** the docs after a PR is merged or closed
1110

1211

@@ -22,65 +21,31 @@ This way you only build and deploy the docs when there are changes to the docs a
2221

2322
```yaml
2423
---
25-
name: docs-build <1>
24+
name: docs-build
2625

2726
on:
28-
push: <2>
27+
push:
2928
branches:
3029
- main
31-
pull_request: ~
30+
pull_request_target: ~
3231

3332
jobs:
3433
docs-preview:
35-
uses: elastic/docs-builder/.github/workflows/preview-build.yml <3>
34+
uses: elastic/docs-builder/.github/workflows/preview-build.yml <2>
3635
with:
37-
path-pattern: docs/** <4>
36+
path-pattern: docs/** <3>
3837
permissions:
38+
id-token: write
39+
deployments: write
3940
contents: read
4041
pull-requests: read
4142
```
4243
43-
1. The naming is important so that the `docs-deploy` workflow is triggered.
44-
2. You can omit the `push` event if you only want to build the docs on PRs.
45-
3. Reusable workflow: [elastic/docs-builder/.github/workflows/preview-build.yml](https://github.com/elastic/docs-builder/blob/main/.github/workflows/preview-build.yml)
46-
4. This should be the path to your docs folder.
47-
44+
1. Reusable workflow: [elastic/docs-builder/.github/workflows/preview-build.yml](https://github.com/elastic/docs-builder/blob/main/.github/workflows/preview-build.yml)
45+
2. This should be the path to your docs folder.
4846
4947
::::
5048
51-
### Deploy
52-
53-
This workflow is triggered when the `docs-build` workflow is completed. The underlying reusable workflow, downloads the artifact and deploys the docs to our preview environment.
54-
55-
56-
::::{dropdown} .github/workflows/docs-deploy.yml
57-
:open:
58-
59-
```yaml
60-
---
61-
name: docs-deploy
62-
63-
on:
64-
workflow_run:
65-
workflows:
66-
- docs-build <1>
67-
types:
68-
- completed
69-
70-
jobs:
71-
docs-preview:
72-
uses: elastic/docs-builder/.github/workflows/preview-deploy.yml <2>
73-
permissions:
74-
contents: none <3>
75-
id-token: write
76-
deployments: write
77-
actions: read
78-
```
79-
1. The name of the previously mentioned `docs-build` workflow.
80-
2. Reusable workflow: [elastic/docs-builder/.github/workflows/preview-deploy.yml](https://github.com/elastic/docs-builder/blob/main/.github/workflows/preview-deploy.yml)
81-
3. No need to read the code.
82-
83-
::::
8449
8550
### Cleanup
8651

0 commit comments

Comments
 (0)