-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make targets and github workflow for publishing docs
This pr adds: - Make docs to build the docs using ascii * Install ascii doc ruby packages using bundle * Convert README.md to main.adoc * Use Make target to build html files - Github action to build and publish docs on github pages. - Zuul job to preview docs Signed-off-by: Chandan Kumar <[email protected]>
- Loading branch information
Showing
8 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build Docs | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/docs* | ||
- docs/** | ||
- Gemfile | ||
jobs: | ||
deploy: | ||
if: github.repository == 'openstack-k8s-operators/watcher-operator' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21.x | ||
- uses: actions/checkout@v4 | ||
with: | ||
# this fetches all branches. Needed because we need gh-pages branch for deploy to work | ||
fetch-depth: 0 | ||
- uses: ruby/[email protected] | ||
with: | ||
ruby-version: '3.2' | ||
|
||
- name: Build docs | ||
run: | | ||
make docs | ||
cp docs_build/watcher-operator/index.html index.html | ||
- name: Prepare gh-pages branch | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git branch -D gh-pages &>/dev/null || true | ||
git checkout --orphan gh-pages | ||
git reset | ||
- name: Commit asciidoc docs | ||
run: | | ||
git add index.html | ||
git commit -m "Rendered docs" | ||
- name: Push rendered docs to gh-pages | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: | | ||
git push --force origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'asciidoctor', '~> 2.0', '>= 2.0.20' | ||
|
||
# Uncomment for ability to convert Markdown to AsciiDoc | ||
gem 'kramdown-asciidoc' | ||
|
||
# Needed for https://github.com/ruby/rexml/issues/131#issuecomment-2116267578 | ||
gem 'rexml', '= 3.2.6' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
BUILD_DIR = ../docs_build | ||
ROOTDIR = $(realpath .) | ||
NAME = watcher-operator | ||
DEST_DIR = $(BUILD_DIR)/$(NAME) | ||
DEST_HTML = $(DEST_DIR)/index.html | ||
IMAGES_DIR = $(DEST_DIR)/images | ||
IMAGES_TS = $(DEST_DIR)/.timestamp-images | ||
MAIN_SOURCE = main.adoc | ||
OTHER_SOURCES = $(shell find ./assemblies -type f) | ||
IMAGES = $(shell find ./images -type f) | ||
ALL_SOURCES = $(MAIN_SOURCE) $(OTHER_SOURCES) $(IMAGES) | ||
UNAME = $(shell uname) | ||
BUNDLE_EXEC ?= bundle exec | ||
|
||
ifeq ($(UNAME), Linux) | ||
BROWSER_OPEN = xdg-open | ||
endif | ||
ifeq ($(UNAME), Darwin) | ||
BROWSER_OPEN = open | ||
endif | ||
|
||
all: html | ||
|
||
html: html-latest | ||
|
||
html-latest: prepare $(IMAGES_TS) $(DEST_HTML) | ||
|
||
prepare: | ||
@mkdir -p $(BUILD_DIR) | ||
@mkdir -p $(DEST_DIR) $(IMAGES_DIR) | ||
|
||
clean: | ||
@rm -rf "$(DEST_DIR)" | ||
|
||
watch-html: | ||
@which inotifywait > /dev/null || ( echo "ERROR: inotifywait not found, install inotify-tools" && exit 1 ) | ||
while true; do \ | ||
inotifywait -r -e modify -e create -e delete .; \ | ||
sleep 0.5; \ | ||
$(MAKE) html; \ | ||
done | ||
|
||
open-html: html | ||
${BROWSER_OPEN} "file://$(realpath $(ROOTDIR)/$(DEST_HTML))" | ||
|
||
$(IMAGES_TS): $(IMAGES) | ||
cp $? $(IMAGES_DIR) | ||
touch $(IMAGES_TS) | ||
|
||
$(DEST_HTML): $(ALL_SOURCES) | ||
$(BUNDLE_EXEC) asciidoctor -a source-highlighter=highlightjs -a highlightjs-languages="yaml,bash" -a highlightjs-theme="monokai" --failure-level WARN -a build=$(BUILD) -b xhtml5 -d book -o $@ $(MAIN_SOURCE) |
Empty file.
Empty file.