Skip to content

Commit 804eda8

Browse files
authored
Feature/previews (#2234)
* Adjust base deployment, and get preview rolling? * Slight DRY-ing. * Fix description. * Rework the local action dealio. Misunderstood the structure, whoops. * Add the shell bits... * Add other permission necessary for the comment business.
1 parent c34ca6d commit 804eda8

File tree

3 files changed

+52
-9
lines changed

3 files changed

+52
-9
lines changed

.github/actions/build/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Build
3+
description: Setup to run and run mkdocs
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Setup build environment
8+
uses: actions/setup-python@v4
9+
with:
10+
python-version: '3.x'
11+
cache: 'pip'
12+
- name: Install build requirements
13+
shell: bash
14+
run: pip install -r requirements.txt
15+
- name: Build docs
16+
shell: bash
17+
run: mkdocs build

.github/workflows/docs-preview.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: "Build docs preview"
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- closed
10+
concurrency: preview-${{ github.ref }}
11+
permissions:
12+
# Needed to update the preview branch.
13+
contents: write
14+
# Needed to write/maintain the comment
15+
pull-requests: write
16+
jobs:
17+
preview:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
- name: Build docs
23+
uses: ./.github/actions/build
24+
- name: Deploy docs preview
25+
uses: rossjrw/pr-preview-action@v1
26+
with:
27+
source-dir: site

.github/workflows/docs.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
workflow_dispatch:
87
permissions:
98
contents: write
109
jobs:
@@ -13,12 +12,12 @@ jobs:
1312
steps:
1413
- name: Checkout code
1514
uses: actions/checkout@v3
16-
- name: Setup build environment
17-
uses: actions/setup-python@v4
15+
- name: Build docs
16+
uses: ./.github/actions/build
17+
- name: Deploy docs
18+
uses: JamesIves/github-pages-deploy-action@v4
1819
with:
19-
python-version: '3.x'
20-
cache: 'pip'
21-
- name: Install build requirements
22-
run: pip install -r requirements.txt
23-
- name: Build and deploy docs
24-
run: mkdocs gh-deploy --force
20+
folder: site
21+
force: false
22+
clean-exclude: |
23+
pr-preview

0 commit comments

Comments
 (0)