|
2 | 2 |
|
3 | 3 | This project hosts the Slicer API documentation served from http://apidocs.slicer.org.
|
4 | 4 |
|
| 5 | +## Automatic Generation and Publishing |
5 | 6 |
|
6 |
| -## Automatic generation |
| 7 | +The Slicer API documentation is automatically generated and published using a GitHub workflow. The |
| 8 | +generated files are pushed to the `gh-pages` branch, which is configured as the source for |
| 9 | +[GitHub Pages](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/). |
7 | 10 |
|
8 |
| -Documentation is automatically generated and pushed to the `gh-pages` branch configured as a [GitHub Pages](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/) source. |
| 11 | +### Workflow Triggers |
9 | 12 |
|
10 |
| -The [slicer-apidocs-builder](https://github.com/Slicer/slicer-apidocs-builder) tool is used within the GitHub workflow |
11 |
| -[doxygen-build-and-publish.yml](.github/workflows/.github/workflows/doxygen-build-and-publish.yml) to checkout Slicer source code, build doxygen documentation and publish generated html pages. |
| 13 | +The [trigger-doxygen-build-and-publish.yml](https://github.com/Slicer/Slicer/blob/main/.github/workflows/trigger-doxygen-build-and-publish.yml) workflow in the `Slicer/Slicer` repository initiates the process whenever: |
| 14 | +- The `main` branch is updated. |
| 15 | +- A new release tag is pushed. |
12 | 16 |
|
13 |
| -Each time the `main` branch of https://github.com/Slicer/Slicer is updated or each time a new release tag |
14 |
| -is pushed, the generated documentation is either added to the `main` folder or added to a new folder |
15 |
| -named after the release tag. Then the updated content is pushed to the `gh-pages` branch. |
| 17 | +### Documentation Generation |
16 | 18 |
|
17 |
| -The simple GitHub post-receive web hook handler triggering a CircleCI build is |
18 |
| -[github-circleci-trigger](https://github.com/Slicer/github-circleci-trigger). It is implemented as |
19 |
| -a Flask application hosted on a free heroku instance. |
| 19 | +The [slicer-apidocs-builder](https://github.com/Slicer/slicer-apidocs-builder) tool handles the |
| 20 | +generation and publication of documentation. It is invoked within the [doxygen-build-and-publish.yml](.github/workflows/doxygen-build-and-publish.yml) workflow maintained in this repository to: |
20 | 21 |
|
21 |
| -## Squash of `gh-pages` branch using a scheduled GitHub Actions worklfow |
| 22 | +1. Check out the Slicer source code. |
| 23 | +2. Build the Doxygen documentation. |
| 24 | +3. Publish the generated HTML files. |
22 | 25 |
|
23 |
| -After some time, the amount of data published on the `gh-pages` exceeds GitHub [recommended size of 1GB][max_size]. |
24 |
| -To cleanup the repository, a [scheduled workflow][schedule] associated with this project |
25 |
| -will be triggered weekly and will execute [gh-pages-squash.sh](./gh-pages-squash.sh) script. |
| 26 | +### Documentation Updates |
26 | 27 |
|
27 |
| -The script simply do a soft reset, amend the first commit and force push the branch `gh-pages`. |
| 28 | +- **Main Branch Updates**: Documentation for the `main` branch is added to the `main` folder. |
| 29 | +- **Release Tags**: Documentation for new release tags is added to a folder named after the tag. |
| 30 | + |
| 31 | +The updated content is pushed to the `gh-pages` branch, ensuring the documentation remains current and accessible. |
| 32 | + |
| 33 | +## Managing the `gh-pages` Branch Size |
| 34 | + |
| 35 | +Over time, the size of the `gh-pages` branch may exceed GitHub's [recommended limit of 1GB][max_size]. |
| 36 | +To manage this, a [scheduled workflow][schedule] is configured to run weekly. This workflow executes |
| 37 | +the [gh-pages-squash.sh](./gh-pages-squash.sh) script, which performs the following actions: |
| 38 | +1. Executes a soft reset. |
| 39 | +2. Amends the first commit. |
| 40 | +3. Force-pushes the `gh-pages` branch. |
| 41 | + |
| 42 | +This ensures that the repository size remains within the recommended limits. |
28 | 43 |
|
29 | 44 | [max_size]: https://help.github.com/articles/what-is-my-disk-quota/
|
30 | 45 | [schedule]: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
31 | 46 |
|
| 47 | +## Programmatic Updates of the `gh-pages` Branch |
32 | 48 |
|
33 |
| -## Programmatically request updates of `gh-pages` branch using GitHub API |
| 49 | +You can manually trigger updates to the `gh-pages` branch using the GitHub API. This is |
| 50 | +useful for debugging or forcing a squash without waiting for the scheduled workflow. |
34 | 51 |
|
35 | 52 | ### Prequisites
|
36 | 53 |
|
37 | 54 | * Generate GitHub token - See [here](https://github.com/settings/tokens)
|
38 | 55 |
|
39 | 56 | ### Squash *gh-pages*
|
40 | 57 |
|
41 |
| -*This is useful to debug the workflow without having to wait.* |
| 58 | +To trigger the squash workflow programmatically, run the following command: |
42 | 59 |
|
43 | 60 | ```
|
44 | 61 | GITHUB_TOKEN=<YOUR_GITHUB_TOKEN> ./trigger-workflow-squash.sh
|
|
0 commit comments