Skip to content

Commit

Permalink
Add webdocs and CI to publish to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
prodrigestivill committed Jun 28, 2024
1 parent ae23784 commit b56da8f
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/*/
6 changes: 4 additions & 2 deletions typescript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions webdocs/Makefile
Original file line number Diff line number Diff line change
@@ -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
Binary file added webdocs/public/favicon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions webdocs/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
</head>
<body>
<h1>r2papi</h1>
<h2>API documentations</h2>
<ul>
<li><a href="python/index.html">Python</a></li>
<li>TypeScript:<ul>
<li><a href="typescript/async/index.html">TypeScript Async</a></li>
<li><a href="typescript/sync/index.html">TypeScript Sync</a></li>
</ul></li>
<li><a href="https://www.radare.org/vdoc/libr/index.htm">Vala</a></li>
</ul>
</body>
</html>
16 changes: 16 additions & 0 deletions webdocs/public/style.css
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit b56da8f

Please sign in to comment.