Skip to content

Commit c0e772c

Browse files
committed
Add docs/ example
1 parent 451e528 commit c0e772c

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

README.md

+29-26
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ parameter:
9595

9696
```yml
9797
# .github/workflows/build-deploy-pages-site.yml
98-
- steps:
98+
steps:
9999
...
100100
- uses: JamesIves/github-pages-deploy-action@v4
101101
...
@@ -190,6 +190,22 @@ jobs:
190190
action: auto
191191
```
192192

193+
### Deployment from `docs/`
194+
195+
If your Pages site is built to `build/` and deployed from the `docs/`
196+
directory on the `main` branch:
197+
198+
```yml
199+
# .github/workflows/preview.yml
200+
steps:
201+
...
202+
- uses: rossjrw/pr-preview-action@v1
203+
with:
204+
source-dir: build
205+
preview-branch: main
206+
umbrella-dir: docs/pr-preview
207+
```
208+
193209
### Only remove previews for unmerged PRs
194210

195211
Information from the context and conditionals can be used to make more
@@ -198,31 +214,18 @@ only those associated with _unmerged_ PRs when they are closed:
198214

199215
```yml
200216
# .github/workflows/preview.yml
201-
name: Deploy PR previews; removed closed unmerged PR previews
202-
concurrency: preview-${{ github.ref }}
203-
on:
204-
pull_request:
205-
types:
206-
- opened
207-
- reopened
208-
- synchronize
209-
- closed
210-
jobs:
211-
deploy-preview:
212-
runs-on: ubuntu-20.04
213-
steps:
214-
- uses: actions/checkout@v2
215-
- run: npm i && npm run build
216-
- uses: rossjrw/pr-preview-action@v1
217-
if: contains(['opened', 'reopened', 'synchronize'], github.event.action)
218-
with:
219-
source-dir: ./build/
220-
action: deploy
221-
- uses: rossjrw/pr-preview-action@v1
222-
if: github.event.action == "closed" && !github.event.pull_request.merged
223-
with:
224-
source-dir: ./build/
225-
action: remove
217+
steps:
218+
...
219+
- uses: rossjrw/pr-preview-action@v1
220+
if: contains(['opened', 'reopened', 'synchronize'], github.event.action)
221+
with:
222+
source-dir: ./build/
223+
action: deploy
224+
- uses: rossjrw/pr-preview-action@v1
225+
if: github.event.action == "closed" && !github.event.pull_request.merged
226+
with:
227+
source-dir: ./build/
228+
action: remove
226229
```
227230

228231
### Permanent previews

0 commit comments

Comments
 (0)