Skip to content

Add step to get latest hugo theme version and set as ENV var #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/docs-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ env:
GO_VERISON: "1.21" # Go version used for `hugo mod get`
HUGO_VERSION: "0.115.3" # Hugo version used for building docs
THEME_MODULE: "github.com/nginxinc/nginx-hugo-theme" # Name of source repo for module. For example; github.com/nginxinc/nginx-hugo-theme
THEME_VERSION: "0.41.10" # Version of theme module. For example; 0.41.6

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

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

- name: Get latest hugo theme
if: inputs.doc_type == 'hugo'
run: echo "THEME_VERSION=$(curl -s https://api.github.com/repos/nginxinc/nginx-hugo-theme/releases/latest | jq -r ".tag_name")" >> "$GITHUB_ENV"

### Hugo builds

- name: Setup Go
Expand All @@ -147,14 +150,14 @@ jobs:
if: inputs.doc_type == 'hugo' && (github.event.action == 'synchronize' || github.event.action == 'opened' || env.DEPLOYMENT_ENV == 'preview')
working-directory: ${{inputs.docs_build_path}}
run: |
hugo mod get -v "$THEME_MODULE@v$THEME_VERSION"
hugo mod get -v "$THEME_MODULE@$THEME_VERSION"
hugo --gc -e production --baseURL="https://${DEPLOYMENT_DOMAIN}${PREVIEW_URL_PATH}/${PR_NUMBER}"

- name: Build Hugo for environment
working-directory: ${{inputs.docs_build_path}}
if: inputs.doc_type == 'hugo' && env.DEPLOYMENT_ENV != 'preview'
run: |
hugo mod get "$THEME_MODULE@v$THEME_VERSION"
hugo mod get "$THEME_MODULE@$THEME_VERSION"
hugo --gc -e production --baseURL="https://${DEPLOYMENT_DOMAIN}${PRODUCTION_URL_PATH}"

### Sphinx builds
Expand Down