Skip to content

Hugo

Hugo #24

Workflow file for this run

name: Hugo
on:
workflow_dispatch: {}
repository_dispatch:
types: [trigger-workflow]
push:
branches:
- main
paths:
- 'docs/**'
- 'website/**'
# 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:
runs-on: [ default ]
env:
HUGO_VERSION: 0.124.1
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout greenhouse repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: greenhouse
submodules: true
fetch-depth: 0
- name: Checkout greenhouse-extensions repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner}}/greenhouse-extensions
ref: ${{ github.event.client_payload.sha }}
path: greenhouse-extensions
submodules: true
fetch-depth: 0
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Custom steps
env:
GREENHOUSE_GIT_DIR: "${{ github.workspace }}/greenhouse"
GREENHOUSE_EXTENSIONS_GIT_DIR: "${{ github.workspace }}/greenhouse-extensions"
DESTINATION_DIR: "docs/reference/catalog"
run: |
cd $GREENHOUSE_GIT_DIR
mkdir -p ${DESTINATION_DIR}
echo "collecting PluginDefinition descriptions from ${GREENHOUSE_EXTENSIONS_GIT_DIR}"
all_files=$(git -C $GREENHOUSE_EXTENSIONS_GIT_DIR grep --recursive --files-with-matches -e "kind: PluginDefinition" -- '*plugin.yaml')
for f in $all_files; do
d=$(dirname $f)
filename="${GREENHOUSE_EXTENSIONS_GIT_DIR}/${d}/README.md"
if [[ ! -f $filename ]]; then
continue
fi
echo "copying ${GREENHOUSE_EXTENSIONS_GIT_DIR}/${d}/README.md" "${DESTINATION_DIR}/${d}.md";
cp $filename "${DESTINATION_DIR}/${d}.md";
done
make -C website content
rm -rf /docs
- name: Copy assets to public directory
env:
GREENHOUSE_GIT_DIR: "${{ github.workspace }}/greenhouse"
run: |
mkdir -p $GREENHOUSE_GIT_DIR/website/public/docs/assets
cp -r $GREENHOUSE_GIT_DIR/docs/assets/* $GREENHOUSE_GIT_DIR/website/public/docs/assets/
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
GREENHOUSE_GIT_DIR: "${{ github.workspace }}/greenhouse"
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
cd $GREENHOUSE_GIT_DIR/website
npm install postcss-cli autoprefixer
hugo mod clean
hugo mod vendor
hugo \
--logLevel info \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./greenhouse/website/public/
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: [ default ]
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4