diff --git a/.github/workflows/docs-pages.yaml b/.github/workflows/docs-pages.yaml index 6978880a11..9b16368a4d 100644 --- a/.github/workflows/docs-pages.yaml +++ b/.github/workflows/docs-pages.yaml @@ -2,10 +2,14 @@ name: "Docs / Publish" # For more information, # see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows +env: + FLAG: ${{ github.repository == 'scylladb/scylla-enterprise' && 'enterprise' || 'opensource' }} + on: push: branches: - - master + - 'master' + - 'enterprise' paths: - "docs/**" workflow_dispatch: @@ -24,12 +28,13 @@ jobs: with: python-version: 3.7 - name: Set up env - run: make -C docs setupenv + run: make -C docs FLAG="${{ env.FLAG }}" setupenv - name: Build docs - run: make -C docs multiversion + run: make -C docs FLAG="${{ env.FLAG }}" multiversion - name: Build redirects - run: make -C docs redirects + run: make -C docs FLAG="${{ env.FLAG }}" redirects - name: Deploy docs to GitHub Pages run: ./docs/_utils/deploy.sh + if: (github.ref_name == 'master' && env.FLAG == 'opensource') || (github.ref_name == 'enterprise' && env.FLAG == 'enterprise') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docs-pr.yaml b/.github/workflows/docs-pr.yaml index adca978bb2..12f2871b64 100644 --- a/.github/workflows/docs-pr.yaml +++ b/.github/workflows/docs-pr.yaml @@ -2,10 +2,14 @@ name: "Docs / Build PR" # For more information, # see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows +env: + FLAG: ${{ github.repository == 'scylladb/scylla-enterprise' && 'enterprise' || 'opensource' }} + on: pull_request: branches: - master + - enterprise paths: - "docs/**" @@ -23,6 +27,6 @@ jobs: with: python-version: 3.7 - name: Set up env - run: make -C docs setupenv + run: make -C docs FLAG="${{ env.FLAG }}" setupenv - name: Build docs - run: make -C docs test + run: make -C docs FLAG="${{ env.FLAG }}" test diff --git a/docs/Makefile b/docs/Makefile index 64085cf488..ca47b1b8f2 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -7,13 +7,20 @@ PAPER := BUILDDIR := _build SOURCEDIR := . PREVIEW_HOST := 127.0.0.1 +FLAG := opensource +CONF_PATH := ./ # Internal variables +ifeq ($(FLAG), enterprise) + CONF_PATH = ./_enterprise +endif + PAPEROPT_a4 := -D latex_paper_size=a4 PAPEROPT_letter := -D latex_paper_size=letter -ALLSPHINXOPTS := -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR) +ALLSPHINXOPTS := -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR) -t $(FLAG) -c $(CONF_PATH) TESTSPHINXOPTS := $(ALLSPHINXOPTS) -W --keep-going -PROD_OPTS := -D html_theme_options.collapse_navigation='false' -D html_theme_options.navigation_depth=3 +PROD_OPTS := -D html_theme_options.collapse_navigation='false' -D html_theme_options.navigation_depth=3 -t $(FLAG) -c $(CONF_PATH) + # Windows variables ifeq ($(OS),Windows_NT) diff --git a/docs/conf.py b/docs/conf.py index 9071af1843..4a2c05ab94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,8 +22,6 @@ LATEST_VERSION = "branch-5.1" UNSTABLE_VERSIONS = ["master", "branch-5.2"] # Set which versions are deprecated. DEPRECATED_VERSIONS = [""] -# Set to enterprise or opensource. -FLAGS = ["opensource"] # -- General configuration ------------------------------------------------ @@ -141,13 +139,7 @@ html_context = {"html_baseurl": html_baseurl} # -- Initialize Sphinx ---------------------------------------------- -def builder_inited(app): - # Add custom flags - for flag in FLAGS: - app.tags.add(flag) - def setup(sphinx): - sphinx.connect('builder-inited', builder_inited) warnings.filterwarnings( action="ignore", category=UserWarning,