wiki_admin.adoc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. = Wiki Admin
  2. :author: mitm
  3. :revnumber: 1.0
  4. :revdate: 2020/07/25
  5. == Overview
  6. The wiki consists of two repositories.
  7. * link:https://github.com/jMonkeyEngine/wiki[wiki]
  8. * link:https://github.com/jMonkeyEngine/wiki-ui[wiki-ui]
  9. The wiki repository holds all documentation while the wiki-ui repository is the user interface for the documentation.
  10. == Wiki
  11. The wiki repository has a workflow that will be triggered when any push is made to the repository or whenever the user interface issues a new release. Every build, all pages are deleted and re-created. The workflow will cache the user interface under the `menu:cache[antora]` directory if there are any changes and the cache folder has been added to the commit command.
  12. [source, yml]
  13. ----
  14. # Detects any updates to package-lock.json and package.json and commits the
  15. # files to root.
  16. # see:
  17. # https://github.com/marketplace/actions/add-commit?version=v4.1.0
  18. # for use options.
  19. - name: Commit Packages
  20. uses: EndBug/add-and-commit@v4
  21. with:
  22. author_name: mitm001
  23. author_email: [email protected]
  24. message: "Commit files for CI workflow"
  25. # Commits these files to root if and only if there are changes.
  26. add: "package-lock.json package.json ./.cache/antora/*"
  27. env:
  28. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  29. ----
  30. This cache allows the build process to run offline.
  31. The workflow can be configured to update the `package-lock` and `package.json` files by editing the `Install Node` command, just as if you were running this from a local repo.
  32. DO NOT UPDATE OR PUSH THESE FILES UNLESS YOU DISCUSS IT WITH THE OTHER ADMINISTRATORS FIRST!
  33. The workflow file `main.yml`, located under menu:github[workflows], can only be edited and pushed using either the github online interface or by using git bash locally and pushing the commit. Using the Atom Editor or git desktop git commands will fail currently at the time of this writing.
  34. The `supplemental-ui` folder holds the content for Anotra search, the header and footer for the ui. Edit these as needed in the wiki repository, but *do not edit* these same files on the `wiki-ui` repository.
  35. Technically, the entire ui can be configured from the wiki repo.
  36. The wiki is an link:https://docs.antora.org/antora/2.3/[Antora] site using the link:https://asciidoctor.org/docs/user-manual/[asciidoctor] syntax. A quick primer for syntax can be found link:https://docs.antora.org/antora/2.3/asciidoc/asciidoc/[here].
  37. == Source files
  38. The source structure is now modularized.
  39. * ROOT - holds content that introduces new users to the jMonkyEngine, installing and features.
  40. * core - this is the main module for any content that is *specific* to an existing jMonkeyEngine class. It maintains similar directories as are found in the jMonkeyEngine link:https://github.com/jMonkeyEngine/jmonkeyengine[repository].
  41. * networking - holds content *specific* to jMonkeyEngine networking.
  42. * physics - holds content *specific* to jMonkeyEngine physics.
  43. * tutorials - holds any content that is *not specific* to any jMonkeyEngine class, may be a generalized concept, may give direction on how to use the engine, or an article of some type about an engine feature.
  44. * sdk - sdk content only. This module may be moved to the sdk repository in the future.
  45. * contributions - existing user project pages. This is a deprecated module and will be removed in the near furture. Do not add new content to this module.
  46. You can decide if a page belongs in the core module by asking yourself a simple question.
  47. _Does the page explain an existing jMonkeyEngine class (excluding physics and networking) found in the jMonkeyEngine repository, without using an external application?_
  48. If yes, then it belongs, otherwise it needs to go someplace else.
  49. == Broken link checking
  50. There is a workflow that can be used to check for broken links.
  51. link:https://github.com/mitm001/link-checker/blob/master/.github/workflows/main.yml[link-checker]
  52. To use it, simply create a repository, paste a copy of the workflow into the `menu:github[workflows]` directory. Before commiting for the first time, set the link:https://github.com/mitm001/link-checker/blob/abddf3d5012b90186ae485073a8c1aaf15a3c447/.github/workflows/main.yml#L25[repo url] to point to the wiki.
  53. If there are any errors, a `linkchecker.md` or `unresolved.md` file will be committed to your repository under the `checked-links` directory. You may need to issue a pull request after a push because of this. The typical workflow consists of fixing reported broken links, deleting all `.md` files and pushing to the repo. Then issue a pull request to see if there are any remaining problems. These files will only be built if there are errors.
  54. If there are no files in the `link-checker` directory and you need to run a check, just create any new file in the `link-checker` directory and push it.
  55. The reason for two files is that the `peter-evans/link-checker@v1` action is not capable of reading relative links properly. This is the only action that is available currently. However, we are in luck in that the Anotora build will set a class on any relative link that fails named `class="page unresolved"`. We can then use a grep command to parse the gh-pages branch and find any file with this class and write it to file.
  56. This is an example of the output for a broken relative link.
  57. ```
  58. tutorials/beginner/hello_collision.html:1289:<p>For a detailed description of the separate jar files see
  59. <a href="#getting-started/jme3_source_structure.adoc#structure-of-jmonkeyengine3-jars"
  60. class="page unresolved">this list</a>.</p>
  61. ```
  62. This gives you the file name:
  63. ```
  64. tutorials/beginner/hello_collision.html
  65. ```
  66. and the name of the broken link to search for in the file:
  67. ```
  68. #getting-started/jme3_source_structure.adoc#structure-of-jmonkeyengine3-jars
  69. ```
  70. All broken links start with a kbd:[#] sign. In this instance, we have an inter document link thats broken as there are two pound signs.
  71. The `peterevans` action will locate all broken image and web urls. There is a problem though that prevents its full use, which is running this on a schedule and automatically opening issues. When Antora builds a site, it will build links from the "`nav-menu`" and "`Table of Contents`" into every page. This will lead to `Too Many Requests (HTTP error 429)` errors. The easiest way to get around this would be to filter the href attribute class for the `nav-link` class, since we know these links are good, and skip them. This is currently not possible using the `petereveans` action. To work around it, just search the `linkchecker.md` for `file or directory` errors.
  72. == User Interface
  73. The `wiki-ui` repository has two workflows. A workflow that will build on any push (main.yml), and one that builds on pushing a tag (release.yml). If you push any tag to the master branch, a release will be created, triggering the wiki build, thereby updating the wiki cache and user interface for the wiki.
  74. This will allow you to make changes to the ui without triggering a build unless you are ready.
  75. The user interface uses standard html in its templates so editing should be familiar to anyone who knows html.
  76. == Versioning
  77. There are two files that control versioning for the wiki, each serves a different purpose.
  78. . `wiki-playbook.yml` - determines what branches to use for content.
  79. . `antora.yml` - controls module versioning.
  80. The wiki uses branches for versioning. The current branch being used for the jMonkeyEngine is *always* the master branch of the wiki. In the playbook this is known as the `*HEAD*` branch.
  81. The `docs` module is the main module for the wiki. Its `antora.yml` file controls the version of the wiki. The playbook uses this version to create the folders inside the `gh-pages` branch, building the content from the branches configured in the playbook.
  82. Branch version names should only target major/minor releases, not the patch of a version, and start with "`v`".
  83. When it's time to cut a new version for the wiki, the process is as follows.
  84. . Create and checkout a new branch that matches the *current version* of the wiki. If the current version (HEAD) is targeting version 3.3 in the `antora.yml` for example, you would name the new branch `v3.3`. Thereby preserving the current master branch content.
  85. . We do not want the Antora `.cache` to be versioned so you need to delete it from the new version branch if it has been commited to the repo.
  86. . Push the branch to the repository.
  87. . Switch to the `master` branch and edit these files:
  88. .. Add the newly created branch to the `branches:` array in `wiki-playbook.yml`.
  89. +
  90. .wiki-playbook.yml
  91. ```
  92. content:
  93. sources:
  94. - url: https://github.com/jMonkeyEngine/wiki.git
  95. branches: [HEAD, v3.4, v3.3, v3.2]
  96. ```
  97. .. Increment the version of the `antora.yml` file.
  98. +
  99. --
  100. .The docs antora.yml
  101. ```
  102. name: docs
  103. title: JME
  104. version: '3.4'
  105. ```
  106. .The docs-wiki antora.yml
  107. ```
  108. name: docs-wiki
  109. title: Wiki Contribution
  110. version: '3.4'
  111. ```
  112. NOTE: The version value is enclosed in a set of single quote marks (') because it starts with a number. As was mentioned earlier, the module versioning is controlled by the `antora.yml` file, not the playbook, so they do not have to match.
  113. --
  114. . Edit any links found in the `README.adoc`, located in the root of the repository, that are versioned, so they match the version value you just set in the `antora.yml` file.
  115. . Stage, commit and push your changes to the repository.
  116. The wiki versioning is now complete but you will need to update the docsearch repo to reflect the changes so that search works properly.
  117. . Navigate to the Algolia `docsearch-config` repo and update the search script.
  118. +
  119. https://github.com/algolia/docsearch-configs
  120. . From the main page, click the btn:[Go to file] button and Enter `jmonkeyengine` into the search line.
  121. . Edit the version line to point to the new version used in the `Antora.yml` file. In this example, the current search is targeting 3.3.
  122. +
  123. --
  124. .Old jmonkeyengine.json
  125. [source, .json]
  126. ----
  127. {
  128. "index_name": "jmonkeyengine",
  129. "start_urls": [
  130. {
  131. "url": "https://wiki.jmonkeyengine.org/docs/(?P<version>.*?)/",
  132. "variables": {
  133. "version": [
  134. "3.3"
  135. ]
  136. }
  137. }
  138. ],
  139. ...
  140. }
  141. ----
  142. The master branch `Antora.yml` file is using 3.4.
  143. .Antora.yml
  144. [source, yml]
  145. ----
  146. name: docs
  147. title: JME
  148. version: '3.4'
  149. ...
  150. ----
  151. Edit the `jmonkeyengine.json` file and push your commit to update the search. It takes approximately 24hrs after the commit is merged for it to take effect.
  152. .Updated jmonkeyengine.json
  153. [source, .json]
  154. ----
  155. {
  156. "index_name": "jmonkeyengine",
  157. "start_urls": [
  158. {
  159. "url": "https://wiki.jmonkeyengine.org/docs/(?P<version>.*?)/",
  160. "variables": {
  161. "version": [
  162. "3.4"
  163. ]
  164. }
  165. }
  166. ],
  167. ...
  168. }
  169. ----
  170. --
  171. Things to know about versions and component modules.
  172. If a version isn't specified in the target page ID (pass:[xref:[email protected]][link text]), and the target and current pages belong to a different docs components, Antora will use the latest version of the target component to complete the page ID.
  173. At the time of this writing, we have two links in the `docs` module (documentation.adoc page) that link to the `docs-wiki` module and one that points from the `docs-wiki` module to the `docs` module license.
  174. Since this is a wiki module, we would want to point to the most current content so not versioning them is the best approach.