Skip to content
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

Update make docs procedure and add workflow to keep it up to date #5794

Merged
merged 4 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions .github/workflows/update-make-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Update `make docs` procedure
on:
schedule:
- cron: '0 7 * * 1-5'
workflow_dispatch:
jobs:
main:
if: github.repository == 'grafana/mimir'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: grafana/writers-toolkit/update-make-docs@update-make-docs/v1
with:
pr_options: >
--label type/docs
9 changes: 8 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
* @grafana/mimir-maintainers

# Documentation.
/docs/ @grafana/docs-metrics @grafana/mimir-maintainers
/.github/workflows/publish-technical-documentation-next.yml @grafana/docs-tooling @grafana/mimir-maintainers
/.github/workflows/publish-technical-documentation-release-helm-charts.yml @grafana/docs-tooling @grafana/mimir-maintainers
/.github/workflows/publish-technical-documentation-release-mimir.yml @grafana/docs-tooling @grafana/mimir-maintainers
/.github/workflows/update-make-docs.yml @grafana/docs-tooling @grafana/mimir-maintainers
/docs/ @grafana/docs-metrics @grafana/mimir-maintainers
/docs/docs.mk @grafana/docs-tooling @grafana/mimir-maintainers
/docs/make-docs @grafana/docs-tooling @grafana/mimir-maintainers
/docs/variables.mk @grafana/docs-tooling @grafana/mimir-maintainers

# Alertmanager and ruler.
/pkg/alertmanager/ @grafana/mimir-ruler-and-alertmanager-maintainers @grafana/mimir-maintainers
Expand Down
26 changes: 8 additions & 18 deletions docs/docs.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The source of this file is https://raw.githubusercontent.com/grafana/writers-toolkit/main/docs/docs.mk.
# 3.0.0 (2023-05-18)
# A changelog is included in the head of the `make-docs` script.
include variables.mk
-include variables.mk.local

Expand Down Expand Up @@ -34,11 +34,6 @@ endif
# First project is considered the primary one used for doc-validator.
PRIMARY_PROJECT := $(subst /,-,$(firstword $(subst :, ,$(firstword $(PROJECTS)))))

# Name for the container.
ifeq ($(origin DOCS_CONTAINER), undefined)
export DOCS_CONTAINER := $(PRIMARY_PROJECT)-docs
endif

# Host port to publish container port to.
ifeq ($(origin DOCS_HOST_PORT), undefined)
export DOCS_HOST_PORT := 3002
Expand Down Expand Up @@ -76,44 +71,39 @@ docs-rm: ## Remove the docs container.

.PHONY: docs-pull
docs-pull: ## Pull documentation base image.
$(PODMAN) pull $(DOCS_IMAGE)
$(PODMAN) pull -q $(DOCS_IMAGE)

make-docs: ## Fetch the latest make-docs script.
make-docs:
if [[ ! -f "$(PWD)/make-docs" ]]; then
if [[ ! -f "$(CURDIR)/make-docs" ]]; then
echo 'WARN: No make-docs script found in the working directory. Run `make update` to download it.' >&2
exit 1
fi

.PHONY: docs
docs: ## Serve documentation locally, which includes pulling the latest `DOCS_IMAGE` (default: `grafana/docs-base:latest`) container image. See also `docs-no-pull`.
docs: docs-pull make-docs
$(PWD)/make-docs $(PROJECTS)
$(CURDIR)/make-docs $(PROJECTS)

.PHONY: docs-no-pull
docs-no-pull: ## Serve documentation locally without pulling the `DOCS_IMAGE` (default: `grafana/docs-base:latest`) container image.
docs-no-pull: make-docs
$(PWD)/make-docs $(PROJECTS)
$(CURDIR)/make-docs $(PROJECTS)

.PHONY: docs-debug
docs-debug: ## Run Hugo web server with debugging enabled. TODO: support all SERVER_FLAGS defined in website Makefile.
docs-debug: make-docs
WEBSITE_EXEC='hugo server --bind 0.0.0.0 --port 3002 --debug' $(PWD)/make-docs $(PROJECTS)
WEBSITE_EXEC='hugo server --bind 0.0.0.0 --port 3002 --debug' $(CURDIR)/make-docs $(PROJECTS)

.PHONY: doc-validator
doc-validator: ## Run doc-validator on the entire docs folder.
doc-validator: make-docs
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) $(PWD)/make-docs $(PROJECTS)

.PHONY: doc-validator/%
doc-validator/%: ## Run doc-validator on a specific path. To lint the path /docs/sources/administration, run 'make doc-validator/administration'.
doc-validator/%: make-docs
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) DOC_VALIDATOR_INCLUDE=$(subst doc-validator/,,$@) $(PWD)/make-docs $(PROJECTS)
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) $(CURDIR)/make-docs $(PROJECTS)

.PHONY: vale
vale: ## Run vale on the entire docs folder.
vale: make-docs
DOCS_IMAGE=$(VALE_IMAGE) $(PWD)/make-docs $(PROJECTS)
DOCS_IMAGE=$(VALE_IMAGE) $(CURDIR)/make-docs $(PROJECTS)

.PHONY: update
update: ## Fetch the latest version of this Makefile and the `make-docs` script from Writers' Toolkit.
Expand Down
Loading
Loading