Skip to content

Add workflow to build technical documentation using full website #25

Add workflow to build technical documentation using full website

Add workflow to build technical documentation using full website #25

name: Build technical documentation
on:
pull_request:
paths: ["docs/sources/**"]
workflow_dispatch:
jobs:
main:
runs-on: ubuntu-latest
container:
image: grafana/docs-base:latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate GitHub token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- name: Sparse clone website repository
run: |
git clone --filter=blob:none --no-checkout --sparse --depth 1 https://x-access-token:${TOKEN}@github.com/grafana/website.git website
git -C website sparse-checkout set content/docs
git -C website checkout master
env:
TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Checkout Actions library
uses: actions/checkout@v3
with:
repository: grafana/grafana-github-actions
path: ./actions
- name: Install Actions from library
run: npm install --production --prefix ./actions
- name: Determine technical documentation version
uses: ./actions/docs-target
id: target
with:
ref_name: ${{ github.base_ref }}
- name: Build website
# Note that busybox `ln` does not have the `-F` option.
run: |
rm -rf /hugo/content/docs
ln -sn "$(pwd)/website/content/docs" /hugo/content/docs
rm -rf "/hugo/content/docs/grafana/${TARGET}"
ln -sn "$(pwd)/docs/sources" "/hugo/content/docs/grafana/${TARGET}"
cd /hugo
unset WEBSITE_SKIP_MOUNTS
make hugo HUGO_ENV=docs | grep docs/grafana/
env:
TARGET: ${{ steps.target.outputs.target }}