18
18
name : Deploy Hugo site to Pages
19
19
20
20
on :
21
+ # Allows you to run this workflow manually from the Actions tab
22
+ workflow_dispatch :
21
23
# Runs on pushes targeting the default branch
22
24
push :
23
25
branches :
28
30
- ' **/package*.json'
29
31
- ' DEV.md'
30
32
- ' 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
34
39
35
40
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
36
41
permissions :
@@ -81,53 +86,28 @@ jobs:
81
86
with :
82
87
enablement : true
83
88
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 }}
106
94
107
95
- name : Build with Hugo
108
- env :
109
- # For maximum backward compatibility with Hugo modules
110
- HUGO_ENVIRONMENT : production
111
- HUGO_ENV : production
112
96
run : |
113
97
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
128
99
129
- - name : Upload artifact
100
+ # Upload the built site to GitHub Pages
101
+ - name : Upload Pages Artifact
130
102
uses : actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
103
+ if : ${{ contains(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 : ${{ !contains(github.ref, 'main') }}
131
111
with :
132
112
path : ./docs/public
133
113
@@ -141,4 +121,5 @@ jobs:
141
121
steps :
142
122
- name : Deploy to GitHub Pages
143
123
id : deployment
124
+ if : ${{ contains(github.ref, 'main') }}
144
125
uses : actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
0 commit comments