-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport the hexdoc-hexcasting web book to 1.18 (#548)
- Loading branch information
Showing
73 changed files
with
2,337 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,60 @@ | ||
name: Build the Python doc-gen | ||
name: Build the web book | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
branches: '1.18' | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: Release this version | ||
type: boolean | ||
default: false | ||
publish: | ||
description: Package index to publish to | ||
type: choice | ||
options: | ||
- none | ||
- PyPI | ||
|
||
env: | ||
PYPI_PACKAGE: hexdoc-hexcasting | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build_docs: | ||
runs-on: ubuntu-latest | ||
hexdoc: | ||
uses: hexdoc-dev/hexdoc/.github/workflows/hexdoc.yml@main | ||
permissions: | ||
contents: write | ||
pages: read | ||
secrets: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
python-version: "3.11" | ||
release: |- | ||
${{ | ||
github.event_name != 'push' && inputs.release | ||
|| github.event_name == 'push' && startsWith(github.event.head_commit.message, '[Release]') | ||
}} | ||
publish-pypi: | ||
runs-on: ubuntu-latest | ||
needs: hexdoc | ||
if: |- | ||
needs.hexdoc.outputs.release == 'true' && | ||
(github.event_name == 'push' || inputs.publish == 'PyPI') | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }} | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Generate file | ||
run: doc/collate_data.py Common/src/main/resources hexcasting thehexbook doc/template.html index.html.uncommitted | ||
- name: Check out gh-pages | ||
uses: actions/checkout@v3 | ||
with: | ||
clean: false | ||
ref: gh-pages | ||
- name: Overwrite file and commmit | ||
run: | | ||
mv index.html.uncommitted index.html | ||
git config user.name "Documentation Generation Bot" | ||
git config user.email "[email protected]" | ||
git add index.html | ||
git diff-index --quiet HEAD || git commit -m "Update docs at index.html from $GITHUB_REF" | ||
- name: Upload changes | ||
run: git push | ||
- name: Download package artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: hexdoc-build | ||
path: dist | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 object-Object, Alwinfy, gamma-delta | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# hexdoc-hexcasting | ||
|
||
Python web book docgen and [hexdoc](https://pypi.org/project/hexdoc) plugin for Hex Casting. | ||
|
||
## Version scheme | ||
|
||
We use [hatch-gradle-version](https://pypi.org/project/hatch-gradle-version) to generate the version number based on whichever mod version the docgen was built with. | ||
|
||
The version is in this format: `mod-version.python-version.mod-pre.python-dev.python-post` | ||
|
||
For example: | ||
* Mod version: `0.11.1-7` | ||
* Python package version: `1.0.dev0` | ||
* Full version: `0.11.1.1.0rc7.dev0` | ||
|
||
## Setup | ||
|
||
```sh | ||
python3.11 -m venv venv | ||
|
||
.\venv\Scripts\activate # Windows | ||
. venv/bin/activate.fish # fish | ||
source venv/bin/activate # everything else | ||
|
||
# run from the repo root, not doc/ | ||
pip install -e .[dev] | ||
``` | ||
|
||
## Usage | ||
|
||
For local testing, create a file called `.env` in the repo root following this template: | ||
```sh | ||
GITHUB_REPOSITORY=gamma-delta/HexMod | ||
GITHUB_SHA=main | ||
GITHUB_PAGES_URL=https://gamma-delta.github.io/HexMod | ||
``` | ||
|
||
Useful commands: | ||
```sh | ||
# show help | ||
hexdoc -h | ||
|
||
# render and serve the web book in watch mode | ||
nodemon --config doc/nodemon.json | ||
|
||
# render and serve the web book | ||
hexdoc serve | ||
|
||
# export, render, and merge the web book | ||
hexdoc export | ||
hexdoc render | ||
hexdoc merge | ||
|
||
# start the Python interpreter with some extra local variables | ||
hexdoc repl | ||
``` |
Oops, something went wrong.