-
Notifications
You must be signed in to change notification settings - Fork 33
/
action.yml
88 lines (81 loc) · 2.56 KB
/
action.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Sphinx to GitHub Pages'
description: 'GitHub Action to deploy Sphinx documentation to GitHub Pages'
author: 'Shengyu Zhang'
branding:
color: 'green'
icon: 'upload-cloud'
inputs:
documentation_path:
description: 'Path to Sphinx source files'
required: false
default: './docs'
requirements_path:
description: 'Path to requirements file'
required: false
default: './docs/requirements.txt'
python_version:
description: 'Version of Python'
required: false
default: '3.10'
sphinx_version:
description: 'Version of Sphinx'
required: false
default: ''
cache:
description: 'Enable cache to speed up documentation building'
required: false
default: false
outputs:
page_url:
description: 'URL to deployed GitHub Pages'
value: ${{ steps.deployment.outputs.page_url }}
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v3
if: ${{ inputs.cache == 'true' }}
with:
fetch-depth: 0 # Required by git-restore-mtime
- name: Checkout
uses: actions/checkout@v3
if: ${{ inputs.cache == 'false' }}
- name: Setup python
uses: actions/setup-python@v4
if: ${{ inputs.cache == 'true' }}
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
- name: Setup python
uses: actions/setup-python@v4
if: ${{ inputs.cache == 'false' }}
with:
python-version: ${{ inputs.python_version }}
- name: Restore cache
uses: actions/cache@v3
if: ${{ inputs.cache == 'true' }}
with:
path: /tmp/sphinxnotes-pages
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: sphinxnotes-pages-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
sphinxnotes-pages-${{ runner.os }}
- name: Build documentation
run: ${{ github.action_path }}/main.sh
shell: bash
env:
# See https://github.com/actions/runner/issues/665
INPUT_DOCUMENTATION_PATH: ${{ inputs.documentation_path }}
INPUT_REQUIREMENTS_PATH: ${{ inputs.requirements_path }}
INPUT_SPHINX_VERSION: ${{ inputs.sphinx_version }}
INPUT_CACHE: ${{ inputs.cache }}
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: /tmp/sphinxnotes-pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1