Skip to content

Commit 48d3b52

Browse files
committed
Add step to get latest hugo theme at run time
1 parent 03a9a38 commit 48d3b52

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/docs-build-push.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ env:
3939
GO_VERISON: "1.21" # Go version used for `hugo mod get`
4040
HUGO_VERSION: "0.115.3" # Hugo version used for building docs
4141
THEME_MODULE: "github.com/nginxinc/nginx-hugo-theme" # Name of source repo for module. For example; github.com/nginxinc/nginx-hugo-theme
42-
THEME_VERSION: "0.41.10" # Version of theme module. For example; 0.41.6
4342

4443
PR_NUMBER: ${{github.event.pull_request.number}}
4544

@@ -129,6 +128,10 @@ jobs:
129128
- name: Checkout docs content
130129
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.7.1
131130

131+
- name: Get latest hugo theme
132+
if: inputs.doc_type == 'hugo'
133+
run: echo "THEME_VERSION=$(curl -s https://api.github.com/repos/nginxinc/nginx-hugo-theme/releases/latest | jq -r ".tag_name")" >> "$GITHUB_ENV"
134+
132135
### Hugo builds
133136

134137
- name: Setup Go
@@ -147,14 +150,14 @@ jobs:
147150
if: inputs.doc_type == 'hugo' && (github.event.action == 'synchronize' || github.event.action == 'opened' || env.DEPLOYMENT_ENV == 'preview')
148151
working-directory: ${{inputs.docs_build_path}}
149152
run: |
150-
hugo mod get -v "$THEME_MODULE@v$THEME_VERSION"
153+
hugo mod get -v "$THEME_MODULE@$THEME_VERSION"
151154
hugo --gc -e production --baseURL="https://${DEPLOYMENT_DOMAIN}${PREVIEW_URL_PATH}/${PR_NUMBER}"
152155
153156
- name: Build Hugo for environment
154157
working-directory: ${{inputs.docs_build_path}}
155158
if: inputs.doc_type == 'hugo' && env.DEPLOYMENT_ENV != 'preview'
156159
run: |
157-
hugo mod get "$THEME_MODULE@v$THEME_VERSION"
160+
hugo mod get "$THEME_MODULE@$THEME_VERSION"
158161
hugo --gc -e production --baseURL="https://${DEPLOYMENT_DOMAIN}${PRODUCTION_URL_PATH}"
159162
160163
### Sphinx builds

0 commit comments

Comments
 (0)