Skip to content

Commit ae8d8bb

Browse files
feat: convert hugo docs workflow calls to use Taskfile task (#642)
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent 9b17937 commit ae8d8bb

22 files changed

+245
-747
lines changed

Diff for: .github/workflows/flow-hugo-publish.yaml

+25-44
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
name: Deploy Hugo site to Pages
1919

2020
on:
21+
# Allows you to run this workflow manually from the Actions tab
22+
workflow_dispatch:
2123
# Runs on pushes targeting the default branch
2224
push:
2325
branches:
@@ -28,9 +30,12 @@ on:
2830
- '**/package*.json'
2931
- 'DEV.md'
3032
- 'README.md'
31-
32-
# Allows you to run this workflow manually from the Actions tab
33-
workflow_dispatch:
33+
# run in the pull request, but don't publish
34+
pull_request:
35+
types:
36+
- opened
37+
- reopened
38+
- synchronize
3439

3540
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
3641
permissions:
@@ -81,58 +86,34 @@ jobs:
8186
with:
8287
enablement: true
8388

84-
- name: Install jsdoc
85-
run: |
86-
cd docs
87-
npm i -g jsdoc
88-
jsdoc --version
89-
jsdoc -c jsdoc.conf.json
90-
cd -
91-
92-
- name: Install jsdoc-to-markdown
93-
run: |
94-
cd docs
95-
npm i -g jsdoc-to-markdown
96-
jsdoc2md --version
97-
./generate_md.sh
98-
cd -
99-
100-
- name: Copy existing documentation
101-
run: |
102-
mkdir -p docs/content/Developer
103-
cp DEV.md docs/content/Developer/DEV.md
104-
mkdir -p docs/content/User
105-
cp README.md docs/content/User/README.md
89+
- name: Install Task
90+
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
91+
with:
92+
version: 3.39.2
93+
repo-token: ${{ secrets.GITHUB_TOKEN }}
10694

10795
- name: Build with Hugo
108-
env:
109-
# For maximum backward compatibility with Hugo modules
110-
HUGO_ENVIRONMENT: production
111-
HUGO_ENV: production
11296
run: |
11397
cd docs
114-
echo "base_url ${{ steps.pages.outputs.base_url }}"
115-
echo "origin ${{ steps.pages.outputs.origin }}"
116-
echo "host ${{ steps.pages.outputs.host }}"
117-
echo "base_path ${{ steps.pages.outputs.base_path }}"
118-
mkdir -p themes/hugo-geekdoc
119-
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
120-
ls -ltr
121-
hugo version
122-
hugo config
123-
hugo \
124-
--gc \
125-
--config hugo.toml \
126-
--minify \
127-
--baseURL "${{ steps.pages.outputs.base_url }}/"
98+
task default
12899
129-
- name: Upload artifact
100+
# Upload the built site to GitHub Pages
101+
- name: Upload Pages Artifact
130102
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
103+
if: ${{ endsWith(github.ref, 'main') }}
104+
with:
105+
path: ./docs/public
106+
107+
# Upload the built site to artifacts for troubleshooting or verification
108+
- name: Upload Artifact
109+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
110+
if: ${{ !endsWith(github.ref, 'main') }}
131111
with:
132112
path: ./docs/public
133113

134114
# Deployment job
135115
deploy:
116+
if: ${{ endsWith(github.ref, 'main') }}
136117
environment:
137118
name: github-pages
138119
url: ${{ steps.deployment.outputs.page_url }}

Diff for: .gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,10 @@ coverage/
516516
deleteme.yaml
517517
/.nyc_output/
518518
/.nvmrc
519+
/docs/public/static/Classes/
520+
/docs/content/Classes/
521+
/docs/content/Developer/DEV.md
522+
/docs/content/User/README.md
523+
/docs/themes/
524+
/docs/.hugo_build.lock
525+
/docs/public/

Diff for: .remarkrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
plugins:
2+
- [ 'remark-frontmatter', 'yaml', '-' ]
23
# Check that markdown is consistent.
34
- remark-preset-lint-consistent
45
# Few recommended rules.

Diff for: docs/Taskfile.yaml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: 3
2+
output: prefixed
3+
dotenv:
4+
- .env
5+
silent: false
6+
7+
env:
8+
HUGO_ENVIRONMENT: production
9+
HUGO_ENV: production
10+
HUGO_BASE_URL: https://hashgraph.github.io/solo
11+
HUGO_ORIGIN: https://hashgraph.github.io
12+
HUGO_HOST: hashgraph.github.io
13+
HUGO_BASEPATH: /solo
14+
15+
tasks:
16+
default:
17+
cmds:
18+
- task: "check-doc-dir"
19+
- task: "clean"
20+
- task: "install"
21+
- task: "build"
22+
23+
start:
24+
cmds:
25+
- task: "default"
26+
- hugo server
27+
28+
check-doc-dir:
29+
status:
30+
- |
31+
if [ "$(basename "$PWD")" != "docs" ]; then
32+
exit 1
33+
fi
34+
cmds:
35+
- |
36+
echo "Error: Must be in the 'docs' directory."
37+
exit 1
38+
39+
clean:
40+
cmds:
41+
- rm -Rf content/Classes
42+
- rm -f content/Developer/DEV.md
43+
- rm -f content/User/README.md
44+
- rm -Rf public
45+
- rm -Rf themes
46+
- rm -f .hugo_build.lock
47+
48+
build:
49+
cmds:
50+
- task: "build:jsdoc"
51+
- task: "build:copy"
52+
- task: "build:hugo"
53+
54+
build:hugo:
55+
cmds:
56+
- echo "base_url $HUGO_BASE_URL"
57+
- echo "origin $HUGO_ORIGIN"
58+
- echo "host $HUGO_HOST"
59+
- echo "base_path $HUGO_BASEPATH"
60+
- mkdir -p themes/hugo-geekdoc
61+
- curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
62+
- hugo version
63+
- hugo config
64+
- hugo --gc --config hugo.toml --minify --baseURL "$HUGO_BASE_URL/"
65+
66+
build:jsdoc:
67+
cmds:
68+
- jsdoc -c jsdoc.conf.json
69+
70+
build:copy:
71+
cmds:
72+
- mkdir -p content/Developer
73+
- cp ../DEV.md content/Developer/DEV.md
74+
- mkdir -p content/User
75+
- cp ../README.md content/User/README.md
76+
77+
install:
78+
cmds:
79+
- task: "install:hugo"
80+
- task: "install:jsdoc"
81+
82+
install:hugo:
83+
status:
84+
- command -v hugo
85+
cmds:
86+
- go install github.com/gohugoio/[email protected]
87+
88+
install:jsdoc:
89+
status:
90+
- command -v jsdoc
91+
cmds:
92+
- npm i -g jsdoc
93+
- jsdoc --version

Diff for: docs/content/_index.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
***
2-
1+
---
32
title: Welcome to Solo Documentation
43
geekdocNav: true
54
geekdocAlign: center
65
geekdocAnchor: false
76
geekdocDescription: Home page for Solo Documentation
8-
9-
***
7+
---
108

119
<!-- markdownlint-capture -->
1210

@@ -23,7 +21,7 @@ geekdocDescription: Home page for Solo Documentation
2321

2422
Solo is an opinionated CLI tool to deploy and manage standalone test networks.
2523

26-
{{< button size="large" relref="getting-started/installation.md" >}}Getting Started{{< /button >}}
24+
{{< button size="large" relref="User/README.md" >}}Getting Started{{< /button >}}
2725

2826
## Feature overview
2927

Diff for: docs/content/contribution/contribution.md

-7
This file was deleted.

Diff for: docs/content/contribution/docs.md

-7
This file was deleted.

0 commit comments

Comments
 (0)