diff --git a/.github/workflows/docs-multiversion.yml b/.github/workflows/docs-multiversion.yml new file mode 100644 index 00000000..57725be4 --- /dev/null +++ b/.github/workflows/docs-multiversion.yml @@ -0,0 +1,36 @@ +name: Build multiversion docs + +on: + push: + branches: [ "master" ] + tags: [ "v*", "V*"] + +env: + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} + +jobs: + + build-multiversion: + if: github.repository == 'DragonOS-Community/DragonOS' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: master + + - name: install requirements + working-directory: ./docs + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + pip3 install -r requirements.txt + + - name: build docs + working-directory: ./docs + shell: bash -ileo pipefail {0} + + run: | + make html-multiversion diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..d654cb24 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,34 @@ +name: Build current version docs + +on: + pull_request: + branches: [ "master" ] + # paths: + # - 'docs/**' + +env: + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} + +jobs: + + build-current-version: + if: github.repository == 'DragonOS-Community/DragonOS' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: install requirements + working-directory: ./docs + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + pip3 install -r requirements.txt + + - name: build docs + working-directory: ./docs + shell: bash -ileo pipefail {0} + + run: | + make html diff --git a/docs/Makefile b/docs/Makefile index d4bb2cbb..25548584 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -18,3 +18,7 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: +html-multiversion: + rm -rf ./$(BUILDDIR) && sphinx-multiversion "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/ diff --git a/docs/_templates/versions.html b/docs/_templates/versions.html new file mode 100644 index 00000000..31a12578 --- /dev/null +++ b/docs/_templates/versions.html @@ -0,0 +1,27 @@ +{%- if current_version %} +