| Eric Ball | b550f93 | 2026-06-29 11:29:26 -0700 | [diff] [blame^] | 1 | --- |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 The Linux Foundation |
| 4 | |
| 5 | name: voltha-docsrelease |
| 6 | |
| 7 | # yamllint disable-line rule:truthy |
| 8 | on: |
| 9 | workflow_dispatch: |
| 10 | push: |
| 11 | branches: |
| 12 | - master |
| 13 | - main |
| 14 | |
| 15 | permissions: |
| 16 | contents: read |
| 17 | |
| 18 | jobs: |
| 19 | build-and-publish: |
| 20 | runs-on: ubuntu-latest |
| 21 | |
| 22 | # Mirrors the values previously defined for the 'sync-dir' job in |
| 23 | # ci-management/jjb/repos/voltha-docs.yaml |
| 24 | env: |
| 25 | BUILD_OUTPUT_PATH: "_build/multiversion/" |
| 26 | SYNC_TARGET_USER: "jenkins" |
| 27 | SYNC_TARGET_SERVER: "static.lfbroadband.org" |
| 28 | SYNC_TARGET_PATH: "/srv/sites/docs.voltha.org/" |
| 29 | |
| 30 | steps: |
| 31 | - name: Checkout repository |
| 32 | # yamllint disable-line rule:line-length |
| 33 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 34 | with: |
| 35 | # Full history, branches and tags are required by |
| 36 | # sphinx-multiversion to build every documented version |
| 37 | fetch-depth: 0 |
| 38 | |
| 39 | - name: Configure Python |
| 40 | # yamllint disable-line rule:line-length |
| 41 | uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 |
| 42 | with: |
| 43 | python-version: "3.10" |
| 44 | |
| 45 | - name: Build multiversion documentation |
| 46 | env: |
| 47 | # Makefile uses GERRIT_BRANCH to identify the current branch |
| 48 | GERRIT_BRANCH: ${{ github.ref_name }} |
| 49 | run: make multiversion |
| 50 | |
| 51 | - name: Configure SSH access to docs server |
| 52 | env: |
| 53 | SSH_PRIVATE_KEY: ${{ secrets.STATIC_LFBB_JENKINS_SSH_KEY }} |
| 54 | run: | |
| 55 | set -eu |
| 56 | mkdir -p ~/.ssh |
| 57 | chmod 700 ~/.ssh |
| 58 | printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa |
| 59 | chmod 600 ~/.ssh/id_rsa |
| 60 | ssh-keyscan -H "$SYNC_TARGET_SERVER" >> ~/.ssh/known_hosts 2>/dev/null |
| 61 | |
| 62 | - name: Sync documentation to docs server |
| 63 | run: | |
| 64 | set -eu -o pipefail |
| 65 | rsync -rvzh --delete-after --exclude=.git \ |
| 66 | "$BUILD_OUTPUT_PATH" \ |
| 67 | "${SYNC_TARGET_USER}@${SYNC_TARGET_SERVER}:${SYNC_TARGET_PATH}" |