-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: new github action workflow to generate static web pages using hugo (
#200) Signed-off-by: Jeffrey Tang <[email protected]>
- Loading branch information
1 parent
2a66fe9
commit fbcf7ca
Showing
8 changed files
with
227 additions
and
16 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,133 @@ | ||
## | ||
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
## | ||
|
||
# Sample workflow for building and deploying a Hugo site to GitHub Pages | ||
name: Deploy Hugo site to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: | ||
- 00120-D-hugo-pipeline | ||
|
||
# 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 | ||
|
||
# Default to bash | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: [self-hosted, Linux, medium, ephemeral] | ||
|
||
steps: | ||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.124.1' | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v4 | ||
with: | ||
enablement: true | ||
|
||
- name: Install jsdoc | ||
run: | | ||
cd docs | ||
npm i -g jsdoc | ||
jsdoc --version | ||
jsdoc -c jsdoc.conf.json | ||
cd - | ||
- name: Install jsdoc-to-markdown | ||
run: | | ||
cd docs | ||
npm i -g jsdoc-to-markdown | ||
jsdoc2md --version | ||
./generate_md.sh | ||
cd - | ||
- name: Copy existing documentation | ||
run: | | ||
mkdir -p docs/content/Developer | ||
cp DEV.md docs/content/Developer/DEV.md | ||
mkdir -p docs/content/User | ||
cp README.md docs/content/User/README.md | ||
- name: Build with Hugo | ||
env: | ||
# For maximum backward compatibility with Hugo modules | ||
HUGO_ENVIRONMENT: production | ||
HUGO_ENV: production | ||
run: | | ||
cd docs | ||
echo "base_url ${{ steps.pages.outputs.base_url }}" | ||
echo "origin ${{ steps.pages.outputs.origin }}" | ||
echo "host ${{ steps.pages.outputs.host }}" | ||
echo "base_path ${{ steps.pages.outputs.base_path }}" | ||
mkdir -p themes/hugo-geekdoc | ||
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1 | ||
ls -ltr | ||
hugo version | ||
hugo config | ||
hugo \ | ||
--gc \ | ||
--config hugo.toml \ | ||
--minify \ | ||
--baseURL "${{ steps.pages.outputs.base_url }}/" | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./docs/public | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: [self-hosted, Linux, medium, ephemeral] | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,9 @@ | ||
--- | ||
main: | ||
- name: User | ||
ref: "/User/README.md" | ||
- name: Developer | ||
ref: "/Developer/DEV.md" | ||
- name: Classes | ||
ref: "/solo/static/Classes/index.html" | ||
external: true |
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,11 @@ | ||
#available icons: https://github.com/thegeeklab/hugo-geekdoc/tree/master/src/icons | ||
--- | ||
more: | ||
- name: Hedera Hashgraph | ||
ref: "https://hedera.com/" | ||
external: true | ||
- name: "View Source" | ||
ref: "https://github.com/hashgraph/solo/issues" | ||
external: true | ||
icon: "gdoc_github" | ||
|
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# find javascript files | ||
FIND_CMD=$(find ../src -name "*js") | ||
|
||
# save result to array | ||
FILES=($FIND_CMD) | ||
|
||
mkdir -p content/Classes | ||
|
||
for i in "${FILES[@]}" | ||
do | ||
# echo $i | ||
# extract base file name from path, remove path and extension | ||
BASENAME=$(basename $i .js) | ||
jsdoc2md --no-cache -c jsdoc2md.conf.json $i > ./content/Classes/$BASENAME.md | ||
done |
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,35 @@ | ||
baseURL = 'https://hashgraph.github.io/solo' | ||
languageCode = 'en-us' | ||
title = 'Solo Documentation' | ||
theme = "hugo-geekdoc" | ||
|
||
# Geekdoc required configuration | ||
pygmentsUseClasses = true | ||
pygmentsCodeFences = true | ||
disablePathToLower = true | ||
|
||
enableGitInfo = true | ||
|
||
|
||
# Required if you want to render robots.txt template | ||
enableRobotsTXT = true | ||
|
||
# Needed for mermaid shortcodes | ||
[markup] | ||
[markup.goldmark.renderer] | ||
# Needed for mermaid shortcode | ||
unsafe = true | ||
[markup.tableOfContents] | ||
startLevel = 1 | ||
endLevel = 9 | ||
|
||
[markup.highlight] | ||
style = "vs" | ||
|
||
[taxonomies] | ||
tag = "tags" | ||
|
||
[params] | ||
# (Optional, default false) Render menu from data file in 'data/menu/main.yaml'. | ||
# See also https://geekdocs.de/usage/menus/#bundle-menu. | ||
geekdocMenuBundle = true |
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,12 @@ | ||
{ | ||
"source": { | ||
"include": [ "../src" ], | ||
"includePattern": ".+\\.(js(doc|x)?|mjs)$" | ||
}, | ||
"sourceType": "module", | ||
"opts": { | ||
"recurse": true, | ||
"destination": "public/static/Classes" | ||
} | ||
} | ||
|
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,10 @@ | ||
{ | ||
"source": { | ||
"includePattern": ".+\\.(js(doc|x)?|mjs)$" | ||
}, | ||
"sourceType": "module", | ||
"opts": { | ||
"recurse": true | ||
} | ||
} | ||
|
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