Skip to content

Commit b6bc798

Browse files
Updating README with new installation instructions
1 parent e89e8f2 commit b6bc798

File tree

1 file changed

+69
-20
lines changed

1 file changed

+69
-20
lines changed

README.md

Lines changed: 69 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,75 @@ Web service that publishes a preview of a GitHub project documentation.
55
The documentation itself has to be built during the project continuous
66
integration and published as a GitHub actions artifact.
77

8-
Then, the repository can be configured to request a preview when
9-
a comment `/preview` is written in the pull request page. The request
10-
is made as en HTTP POST request, for example:
11-
12-
```
13-
curl -X POST https://docs-previewer-server.com/preview/pandas-dev/pandas/56907/
8+
## Client installation
9+
10+
To be able to use this service in your project, you need to have a CI
11+
job that looks like this:
12+
13+
```yaml
14+
on: [ push, pull_request ]
15+
16+
jobs:
17+
doc:
18+
name: Build Documentation
19+
runs-on: ubuntu-latest
20+
steps:
21+
# Instead of this step you may have a step to check out the repository,
22+
# another to call `sphinx-build`, or anything that generates a directory
23+
# with the html version of your website or documentation
24+
- run: mkdir docs_dir && echo "Preview is working!" > docs_dir/index.html
25+
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: docs_artifact
29+
path: docs_dir
1430
```
1531
16-
This will cause the server to download the artifact and extract it, so it is
17-
available for example at https://docs-previewer-server.com/previews/56907/
18-
19-
The server will automatically delete old previews.
32+
Then, you can add one action in your CI to for example publish the website or
33+
documentation of a pull request when a user writes a comment with the content
34+
`/preview`:
35+
36+
```yaml
37+
on:
38+
issue_comment:
39+
types: created
40+
41+
jobs:
42+
previewer:
43+
runs-on: ubuntu-latest
44+
permissions:
45+
pull-requests: write
46+
if: github.event.issue.pull_request && github.event.comment.body == '/preview'
47+
steps:
48+
- uses: pandas-dev/github-doc-previewer@master
49+
with:
50+
# The server specified here has to explicitly allow your GitHub organization
51+
previewer-server: "https://pandas.pydata.org"
52+
53+
# Note that this has to match with the name of the job where the
54+
# `upload-artifact` action is called
55+
artifact-job: "Build Documentation"
56+
```
2057
21-
## Installation
58+
## Server Installation
2259
23-
A package is provided for Debian based systems. It can be installed with
24-
the next command:
60+
Currently only packages for Debian are provided. The package can be installed
61+
using the next command:
2562
2663
```
27-
curl -sLO https://github.com/pandas-dev/github-doc-previewer/releases/download/v0.1.1/doc-previewer_0.1.1-1_amd64.deb \
28-
&& sudo dpkg -i doc-previewer_0.1.1-1_amd64.deb \
29-
&& rm doc-previewer_0.1.1-1_amd64.deb
64+
curl -sLO https://github.com/pandas-dev/github-doc-previewer/releases/download/v0.2.0/doc-previewer_0.2.0-1_amd64.deb \
65+
&& sudo dpkg -i doc-previewer_0.2.0-1_amd64.deb \
66+
&& rm doc-previewer_0.2.0-1_amd64.deb
3067
```
3168

32-
To start the server:
69+
To start the service:
3370

3471
```
35-
nohup doc-previewer > /var/log/doc-previewer.log 2>&1 &
72+
sudo systemctl enable doc-previewer.service
73+
sudo systemctl start doc-previewer.service
3674
```
3775

38-
## Configuration
76+
### Configuration
3977

4078
A sample configuration file is next:
4179

@@ -52,11 +90,22 @@ url = "https://doc-previewer.pydata.org/"
5290
[github]
5391
entrypoint = "https://api.github.com/repos/"
5492
token = "xxxxx"
55-
allowed_owners = [ "pydata", "pandas-dev" ]
93+
allowed_owners = [ "pandas-dev", "pydata" ]
5694

5795
[log]
5896
level = "info"
5997
format = "%a %{User-Agent}i"
6098
```
6199

62100
All the fields are optional except for the GitHub token, which is required.
101+
102+
### Logging
103+
104+
When a problem exists, the service will in general report it to the client.
105+
Checking the logs of the `github-doc-previewer` action run that failed may
106+
provide information on the cause of the problem. Errors will also be logged
107+
in the server, and can be checked using the standard journal logs:
108+
109+
```bash
110+
journalctl -u doc-previewer.service
111+
```

0 commit comments

Comments
 (0)