diff --git a/.github/workflows/doc-build-and-publish-zoomin.yml b/.github/workflows/doc-build-and-publish-zoomin.yml deleted file mode 100644 index 2cfc3bdf..00000000 --- a/.github/workflows/doc-build-and-publish-zoomin.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Documentation Build and Publish to Zoomin - -on: - workflow_dispatch: - inputs: - documentation_tag: - type: string - required: false - default: "latest" - description: "Label of the documentation" - publish_to_prod: - type: boolean - default: true - publish_to_dev: - type: boolean - default: true - - workflow_call: - inputs: - documentation_tag: - type: string - required: true - default: "latest" - publish_to_prod: - type: boolean - default: true - publish_to_dev: - type: boolean - default: true - -env: - DOXYGEN_VERSION: 1.12.0 - -jobs: - doc-build-and-publish: - env: - ARCHIVE: "addon-serial_modem-${{inputs.documentation_tag}}.zip" - - runs-on: ubuntu-latest - - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - - permissions: - contents: write - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y python3 python3-pip - - - name: Install Python dependencies - working-directory: doc - run: | - python3 -m pip install -r requirements.txt - - - name: Install Doxygen - run: | - wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" - tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz - echo "${PWD}/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH - - - name: Build documentation - working-directory: doc - run: | - doxygen - sphinx-build -M html . build - - cp custom.properties build/html - sed -i 's/__VERSION__/'"${{inputs.documentation_tag}}"'/g' build/html/custom.properties - - cp tags.yml build/html - sed -i 's/__VERSION__/'"${{inputs.documentation_tag}}"'/g' build/html/tags.yml - - cd build/html - - zip -rq "${{env.ARCHIVE}}" . - ls -lah . - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: doc-build - if-no-files-found: error - retention-days: 2 - path: | - doc/build/html/${{env.ARCHIVE}} - - - name: Prepare Key - run: | - mkdir -p ~/.ssh - ssh-keyscan upload-v1.zoominsoftware.io >> ~/.ssh/known_hosts - - echo "${{ secrets.ZOOMIN_KEY }}" > zoomin_key - chmod 600 zoomin_key - - - name: Publish documentation - prod - if: ${{inputs.publish_to_prod}} - run: | - sftp -v -i zoomin_key nordic@upload-v1.zoominsoftware.io <> $GITHUB_PATH + + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: 3.12 + cache: pip + cache-dependency-path: doc/requirements.txt + pip-install: | + -r doc/requirements.txt + + - name: Build + working-directory: doc + run: | + doxygen + sphinx-build -M html . build + + - name: Check version + run: | + VERSION_REGEX="^v([0-9a-zA-Z\.\-]+)$" + if [[ ${GITHUB_REF#refs/tags/} =~ $VERSION_REGEX ]]; then + VERSION=${BASH_REMATCH[1]} + elif [[ ${GITHUB_REF#refs/heads/} == "main" ]]; then + VERSION="latest" + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + VERSION="pr-${{ github.event.number }}" + fi + echo "VERSION=${VERSION}" + echo "VERSION=${VERSION}" >> "$GITHUB_ENV" + + - name: Prepare Azure upload + run: | + PUBLISH="$PWD/publish" + mkdir -p "$PUBLISH" + + MONITOR="monitor_${{ github.run_id }}.txt" + + # Create documentation upload files + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + ARCHIVE="legacy-addon-serial_modem-pr-${{ github.event.number }}.zip" + echo "publish2 dev PR-${{ github.event.number }} ${ARCHIVE}" > "${MONITOR}" + echo "${{ github.event.number }}" > pr.txt + else + ARCHIVE="legacy-addon-serial_modem-${VERSION}.zip" + echo "publish2 main ${VERSION} ${ARCHIVE}" > "${MONITOR}" + fi + + pushd "doc/build/html" + zip -rq "${ARCHIVE}" . + mv "${ARCHIVE}" "$PUBLISH" + popd + + mv "${MONITOR}" "$PUBLISH" + if [[ -f pr.txt ]]; then mv pr.txt "$PUBLISH"; fi + + - name: Prepare Zoomin upload + if: ${{ github.event_name == 'push' }} + run: | + PUBLISH="$PWD/publish" + mkdir -p "$PUBLISH" + + OUTDIR=doc/build/html + ARCHIVE="addon-serial_modem_$VERSION.zip" + + cp doc/custom.properties "$OUTDIR/custom.properties" + sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/custom.properties" + + cp doc/tags.yml "$OUTDIR/tags.yml" + sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/tags.yml" + + pushd "$OUTDIR" + zip -rq "$ARCHIVE" . + mv "$ARCHIVE" "$PUBLISH" + popd + + - name: Store + if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }} + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: docs + retention-days: 5 + path: | + publish/* diff --git a/doc/conf.py b/doc/conf.py index 10299a07..f61ab8ea 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -10,7 +10,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'ncs-serial-modem' -copyright = '2025, Nordic Semiconductor' +copyright = '2026, Nordic Semiconductor' author = 'Nordic Semiconductor' release = '0.1.0' @@ -27,6 +27,8 @@ 'breathe', 'sphinx_tabs.tabs', 'sphinx_togglebutton', + "sphinxcontrib.jquery", + "sphinx_copybutton", ] templates_path = ['_templates'] @@ -36,6 +38,11 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = 'sphinx_ncs_theme' +html_show_sphinx = False + +html_theme_options = {'docsets': {},"addons_url": "https://nrfconnect.github.io/ncs-app-index/","bare_metal_url": "","ncs_url": "https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/index.html", "ncs_label": "nRF Connect SDK Docs", "logo_url": "https://docs.nordicsemi.com"} + +html_extra_path = ['versions.json'] ## -- Options for Breathe ---------------------------------------------------- # https://breathe.readthedocs.io/en/latest/index.html diff --git a/doc/requirements.txt b/doc/requirements.txt index 2d4a81d0..9a4e8eb0 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,8 @@ Sphinx==5.3.0 breathe==4.35.0 -sphinx-ncs-theme==0.7.4 +sphinx-ncs-theme<2.1 sphinx-tabs>=3.4 sphinx-togglebutton>=0.3.2 Pillow>=9.0.1 +sphinxcontrib.jquery +sphinx-copybutton diff --git a/doc/versions.json b/doc/versions.json new file mode 100644 index 00000000..e5b35570 --- /dev/null +++ b/doc/versions.json @@ -0,0 +1,3 @@ +[ + "1.0.0" +]