From b56da8f2811f1ae85b686ebaee5a589dbbdf3e6c Mon Sep 17 00:00:00 2001 From: Pau RE Date: Fri, 28 Jun 2024 17:29:47 +0200 Subject: [PATCH] Add webdocs and CI to publish to github pages --- .github/workflows/gh-pages.yml | 55 +++++++++++++++++++++++++++++++++ .gitignore | 4 +++ typescript/Makefile | 6 ++-- webdocs/Makefile | 18 +++++++++++ webdocs/public/favicon.ico | Bin 0 -> 1406 bytes webdocs/public/index.html | 21 +++++++++++++ webdocs/public/style.css | 16 ++++++++++ 7 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/gh-pages.yml create mode 100644 webdocs/Makefile create mode 100644 webdocs/public/favicon.ico create mode 100644 webdocs/public/index.html create mode 100644 webdocs/public/style.css diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..2385809 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,55 @@ +name: Publish webdocs to GitHub Pages + +on: + # Runs on pushes targeting the master branch + push: + branches: + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt-get --assume-yes update + sudo apt-get --assume-yes install sphinx + sudo npm i -g typedoc + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build webdocs + run: make -C webdocs + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./webdocs/public + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore index fce9f31..99ac81f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,12 @@ venv/ .pytest_cache dist/ htmlcov/ +python/docs/_build +typescript/*/docs/ +typescript/docs.zip typescript/sync/*.ts typescript/sync/*.json typescript/node_modules typescript/build typescript/docs +webdocs/public/*/ diff --git a/typescript/Makefile b/typescript/Makefile index bb8d2c6..db340ff 100644 --- a/typescript/Makefile +++ b/typescript/Makefile @@ -93,14 +93,16 @@ node_modules/jsfmt: MODVER=$(shell node -e 'console.log(JSON.parse(require("fs").readFileSync("package.json"))["version"])') -doc docs: sync +docs-html: sync npm run adoc npm run sdoc + +doc docs: docs-html rm -f docs.zip zip -r docs.zip sync/docs async/docs r2 -qc "open docs/index.html" -- -.PHONY: doc docs webdoc +.PHONY: doc docs docs-html webdoc webdoc: npm run doc diff --git a/webdocs/Makefile b/webdocs/Makefile new file mode 100644 index 0000000..e991513 --- /dev/null +++ b/webdocs/Makefile @@ -0,0 +1,18 @@ +.PHONY: web clean + +web: public/typescript public/python + +public/typescript: + rm -Rf public/typescript + mkdir -p public/typescript + make -C ../typescript docs-html + mv ../typescript/sync/docs public/typescript/sync + mv ../typescript/async/docs public/typescript/async + +public/python: + rm -Rf public/python + make -C ../python/docs html + mv ../python/docs/_build/html public/python + +clean: + rm -Rf public/typescript public/python \ No newline at end of file diff --git a/webdocs/public/favicon.ico b/webdocs/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..fe159d91d747b2379012afd18ea979ba9679e507 GIT binary patch literal 1406 zcmeH{u}T9$5Qe|q%Xvxec3qpK5Jh645DOn67M9xh5=j$MXd@OrfL1<@R(TRhVXs&T zhO9H^T^W#c!p$=K@Bh#2FwDY&kre{6w;89<1CGT-;y_&Wb=J*y==FEm+aEAEJYslq z%INHzi_0s&&P@%%F9b@9gg=Lg?$$uh2pF|I4y=*xFqgNxuUyZnX-sqKe8nH4L_A0U literal 0 HcmV?d00001 diff --git a/webdocs/public/index.html b/webdocs/public/index.html new file mode 100644 index 0000000..79fafa7 --- /dev/null +++ b/webdocs/public/index.html @@ -0,0 +1,21 @@ + + + + + + + + + +

r2papi

+

API documentations

+ + + \ No newline at end of file diff --git a/webdocs/public/style.css b/webdocs/public/style.css new file mode 100644 index 0000000..263ca10 --- /dev/null +++ b/webdocs/public/style.css @@ -0,0 +1,16 @@ +a, a:visited, a:link, a:active { + text-decoration: none !important ; + color:#ffb900!important; +} +a:hover { + text-decoration: underline !important; + text-shadow: 0px 0px 2px black; + color: #f0e000!important; +} +body { + background-color:#151515; + font-family:montserrat; + color:#f0f0f0; + border:0px; + padding-bottom:4em; +} \ No newline at end of file