-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create workflow to deploy docs to github pages
- Loading branch information
xand6r
committed
Dec 11, 2024
1 parent
87b45b5
commit 9c5bcf6
Showing
7 changed files
with
379 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Set up Node.js environment (if using Node.js) | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 # Replace with your project's Node.js version | ||
|
||
- name: Build project | ||
run: cd docs && bash generatedocs.sh # Adjust based on your project's build command | ||
|
||
# Step 4: Deploy to GitHub Pages | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs # Replace with your build output directory |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,204 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Usherlabs Docs</title> | ||
</head> | ||
|
||
<body> | ||
<!-- the nav section --> | ||
<nav> | ||
<div> | ||
<img src="https://usherlabs.imgix.net/wp-content/uploads/2023/07/Labs-Icon-Concept-2.png?auto=format%2Ccompress&fit=crop&ixlib=php-3.3.0&max-h=800&max-w=800&s=ee768be555714c020bd0a18bffa7dfe3" | ||
alt="" srcset="" height="13px"> | ||
<p> | ||
DOCS.RS | ||
</p> | ||
</div> | ||
</nav> | ||
<!-- the nav section --> | ||
|
||
<!-- the body section --> | ||
|
||
<section class="page__content"> | ||
|
||
<!-- heading section --> | ||
<section class="heading"> | ||
<div class="heading__text"> | ||
<img src="https://usherlabs.imgix.net/wp-content/uploads/2023/07/Labs-Icon-Concept-2.png?auto=format%2Ccompress&fit=crop&ixlib=php-3.3.0&max-h=800&max-w=800&s=ee768be555714c020bd0a18bffa7dfe3" | ||
alt="" srcset="" height="13px"> | ||
<h2> | ||
Usher Labs | ||
</h2> | ||
</div> | ||
</section> | ||
<!-- heading section --> | ||
|
||
<section class="packages"> | ||
|
||
<!-- sample package structure --> | ||
<!-- <ul class="packages__list"> | ||
<li class="packages__list__item"> | ||
<span class="package__name"> | ||
micromegas-tracing-0.2.2 | ||
</span> | ||
<span class="package__description"> | ||
instrumentation module, part of micromegas | ||
</span> | ||
</li> | ||
</ul> --> | ||
<!-- sample package structure --> | ||
|
||
<p class="packages__title">Packages</p> | ||
<ul class="packages__list"> | ||
|
||
<!-- !DONOTCHANGE a script is going to use this keyword to inject content --> | ||
packages_list | ||
<!-- !DONOTCHANGE a script is going to use this keyword to inject content--> | ||
|
||
</ul> | ||
|
||
</section> | ||
<!-- packages section --> | ||
<!-- packages section --> | ||
|
||
</section> | ||
|
||
<!-- the body section --> | ||
|
||
</body> | ||
<style> | ||
:root { | ||
--max-width: 1160px; | ||
--color-background: #353535; | ||
--color-navbar-standard: #ddd; | ||
--color-border: #4e4e4e; | ||
--color-url: #d2991d; | ||
--color-background-code: #2a2a2a; | ||
--color-border: #4e4e4e; | ||
--color-standard: #c0c0c0; | ||
} | ||
|
||
body { | ||
padding: 0; | ||
margin: 0; | ||
position: relative; | ||
min-height: 100vh; | ||
text-align: center; | ||
font: 16px / 1.4 "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
background-color: var(--color-background); | ||
color: var(--color-standard); | ||
} | ||
|
||
nav { | ||
border-bottom: 1px solid var(--color-border); | ||
} | ||
|
||
nav div { | ||
max-width: var(--max-width); | ||
margin: auto; | ||
display: flex; | ||
color: white; | ||
align-items: center; | ||
gap: 10px; | ||
padding: 6.4px 16px; | ||
} | ||
|
||
nav p { | ||
font-size: 12.5px; | ||
color: var(--color-navbar-standard); | ||
margin: 0; | ||
margin-top: 3px; | ||
} | ||
|
||
.page__content { | ||
max-width: var(--max-width); | ||
margin: auto; | ||
} | ||
|
||
section.heading { | ||
padding-top: 22px; | ||
padding-bottom: 60px; | ||
} | ||
|
||
.heading__text { | ||
display: flex; | ||
color: white; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 10px; | ||
margin: 20px 0 10px 0; | ||
padding-bottom: 6px; | ||
font-size: 46px; | ||
} | ||
|
||
.heading__text img { | ||
height: 54px; | ||
border: 2px solid white; | ||
border-radius: 50%; | ||
} | ||
|
||
.heading__text h2 { | ||
font-size: 48px; | ||
padding-bottom: 6px; | ||
color: var(--color-brand); | ||
margin: 0; | ||
margin-top: 7px; | ||
} | ||
|
||
.packages { | ||
max-width: var(--max-width); | ||
margin: auto; | ||
} | ||
|
||
|
||
ul.packages__list { | ||
color: white; | ||
list-style-type: none; | ||
padding-left: 0; | ||
margin-top: 0; | ||
} | ||
|
||
li.packages__list__item { | ||
text-align: left; | ||
cursor: pointer; | ||
padding: 7px 0px; | ||
margin: 0px 16px; | ||
transition: 300ms; | ||
border-top: 1px solid var(--color-border); | ||
} | ||
|
||
.packages__list__item a { | ||
display: grid; | ||
grid-template-columns: 235px 1fr; | ||
gap: 2px 10px; | ||
text-decoration: none; | ||
} | ||
|
||
li.packages__list__item:hover { | ||
background-color: var(--color-background-code); | ||
} | ||
|
||
span.package__name { | ||
color: var(--color-url); | ||
font-weight: bold; | ||
} | ||
|
||
span.package__description { | ||
color: rgb(192, 192, 192); | ||
} | ||
|
||
p.packages__title { | ||
color: var(--color-standard); | ||
text-align: left; | ||
font-weight: bold; | ||
padding: 7px 0px; | ||
margin: 0px 16px; | ||
} | ||
</style> | ||
|
||
</html> |
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,68 @@ | ||
#!/bin/bash | ||
# run this command to generate docs `bash generatedocs.sh` | ||
|
||
# Create an array of destinations we want to generate docs for | ||
projects_dirs=( | ||
"../ic/libraries" | ||
"../rs/verity-client" | ||
"../rs/local-verify" | ||
"../rs/remote-verify" | ||
"../rs/verity-client" | ||
"../zk/guest" | ||
"../zk/host" | ||
) | ||
|
||
# The template for the list | ||
item_html_template=' | ||
<li class="packages__list__item"> | ||
<a target="_blank" href="package_path_placeholder"> | ||
<span class="package__name"> name_placeholder </span> | ||
<span class="package__description"> description_placeholder </span> | ||
</a> | ||
</li> | ||
' | ||
|
||
# The filled template | ||
package_list_html='' | ||
|
||
for current_dir in ${projects_dirs[@]}; do | ||
# Obtain the Cargo.toml file to the current_directory in the integration | ||
manifest_path="$current_dir/Cargo.toml" | ||
|
||
# Use grep and sed to extract the value of the name, description and version of the package | ||
package_name=$(grep -oP '^name\s*=\s*"\K[^"]+' "$manifest_path") | ||
package_description=$(grep -oP '^description\s*=\s*"\K[^"]+' "$manifest_path") | ||
package_version=$(grep -oP '^version\s*=\s*"\K[^"]+' "../Cargo.toml") | ||
|
||
package_name_and_version="$package_name-$package_version" | ||
underscore_package_name=${package_name//-/_} | ||
|
||
# Obtain the target_directory where the docs will be saved based on the package name | ||
target_dir="./packages/$package_name" | ||
|
||
# Run the command to generate the docs | ||
cargo doc --manifest-path "$manifest_path" --target-dir "$target_dir" | ||
|
||
path_to_docs=("./packages/$package_name/doc/$underscore_package_name/index.html") | ||
|
||
# Replace name and description placeholders in the template | ||
processed_html=$(echo "$item_html_template" | sed -e "s|name_placeholder|$package_name_and_version|g" -e "s|description_placeholder|$package_description|g" -e "s|package_path_placeholder|$path_to_docs|g") | ||
|
||
# Append the processed HTML to the final string | ||
package_list_html+="$processed_html" | ||
|
||
done | ||
|
||
input_file_path="./base.html" | ||
output_file_path="./index.html" | ||
|
||
input_file=$(cat $input_file_path) | ||
|
||
# Split the content into parts using 'packages_list' as the delimiter | ||
before_placeholder=${input_file%%packages_list*} | ||
after_placeholder=${input_file#*packages_list} | ||
|
||
full_html="$before_placeholder $package_list_html $after_placeholder" | ||
|
||
# echo "Replaced 'packages_list' with the content of 'list_items' in $input_file_path." | ||
echo $full_html >$output_file_path |
Oops, something went wrong.