-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (62 loc) · 2.25 KB
/
documentation.yaml
File metadata and controls
72 lines (62 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: documentation
on:
push:
branches: [ main ]
pull_request_target:
types: [opened, reopened, synchronize, closed]
workflow_dispatch:
permissions:
contents: write # needed for gh-pages deployment
pull-requests: write # needed to post PR comments
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -U -e .'[doc]'
- name: Sphinx build
timeout-minutes: 15
run: |
python deapi/simulated_server/initialize_server.py 13240 &
sleep 5 &&
sphinx-build doc _build &&
kill %1
env:
GITHUB_PR_NUMBER: ${{ github.event.number || '' }}
# Deploy to GitHub Pages for main branch
- name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: _build/
force_orphan: true
# Deploy PR preview (separate repo)
- name: Deploy PR preview
if: github.event_name == 'pull_request_target'
uses: rossjrw/pr-preview-action@v1
with:
source-dir: _build
deploy-repository: PreviewDE/deapi-preview
token: ${{ secrets.PREVIEW_DEPLOY_KEY }}
comment: false # disable built-in sticky comment
- name: Comment
if: github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
message: |
**Preview for PR #${{ github.event.number }}**
[View the preview here](https://previewde.github.io/deapi-preview/pr-preview/pr-${{ github.event.number }}/)
*(Built from a fork branch and deployed to [PreviewDE/deapi-preview](https://github.com/PreviewDE/deapi-preview))*
env:
GITHUB_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}