Skip to content

Commit

Permalink
ci: new github action workflow to generate static web pages using hugo (
Browse files Browse the repository at this point in the history
#200)

Signed-off-by: Jeffrey Tang <[email protected]>
  • Loading branch information
JeffreyDallas authored Apr 4, 2024
1 parent 2a66fe9 commit fbcf7ca
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 16 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/flow-hugo-publish.yaml
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
9 changes: 9 additions & 0 deletions docs/data/menu/main.yml
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
11 changes: 11 additions & 0 deletions docs/data/menu/more.yml
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"

17 changes: 17 additions & 0 deletions docs/generate_md.sh
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
35 changes: 35 additions & 0 deletions docs/hugo.toml
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
12 changes: 12 additions & 0 deletions docs/jsdoc.conf.json
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"
}
}

10 changes: 10 additions & 0 deletions docs/jsdoc2md.conf.json
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
}
}

16 changes: 0 additions & 16 deletions src/core/account_manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,6 @@ const REASON_FAILED_TO_CREATE_K8S_S_KEY = 'failed to create k8s scrt key'
const FULFILLED = 'fulfilled'
const REJECTED = 'rejected'

/**
* Copyright (C) 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.
*
*/
export class AccountManager {
/**
* creates a new AccountManager instance
Expand Down

0 comments on commit fbcf7ca

Please sign in to comment.