|
| 1 | +name: Documentation Build and Deploy CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - release/* |
| 8 | + paths: |
| 9 | + - 'docs/**' |
| 10 | + - '.github/workflows/docs.yml' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - 'docs/**' |
| 14 | + - '.github/workflows/docs.yml' |
| 15 | + |
| 16 | +jobs: |
| 17 | + |
| 18 | + build-docs: |
| 19 | + name: Build ESP-Docs |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + defaults: |
| 22 | + run: |
| 23 | + shell: bash |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + with: |
| 27 | + submodules: true |
| 28 | + - uses: actions/setup-python@v4 |
| 29 | + with: |
| 30 | + python-version: '3.10' |
| 31 | + - name: Build |
| 32 | + run: | |
| 33 | + sudo apt update |
| 34 | + sudo apt install python3-pip python3-setuptools |
| 35 | + # GitHub CI installs pip3 and setuptools outside the path. |
| 36 | + # Update the path to include them and run. |
| 37 | + cd ./docs |
| 38 | + PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary |
| 39 | + PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en |
| 40 | + - name: Archive Docs |
| 41 | + uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: docs |
| 44 | + path: docs |
| 45 | + |
| 46 | + deploy-preview-docs: |
| 47 | + name: Deploy Documentation |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + defaults: |
| 50 | + run: |
| 51 | + shell: bash |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + submodules: true |
| 56 | + - uses: actions/setup-python@v2 |
| 57 | + with: |
| 58 | + python-version: '3.10' |
| 59 | + - name: Deploy Preview |
| 60 | + env: |
| 61 | + # Deploy to production server |
| 62 | + # DOCS_BUILD_DIR: "./docs/_build/" |
| 63 | + # DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_DEPLOY_KEY }} |
| 64 | + # DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }} |
| 65 | + # DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_SERVER_USER }} |
| 66 | + # DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }} |
| 67 | + # DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }} |
| 68 | + # Deploy to preview server |
| 69 | + TYPE: "preview" |
| 70 | + DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/" |
| 71 | + DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }} |
| 72 | + DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }} |
| 73 | + DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }} |
| 74 | + DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }} |
| 75 | + DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }} |
| 76 | + run: | |
| 77 | + sudo apt update |
| 78 | + sudo apt install python3-pip python3-setuptools |
| 79 | + source ./docs/utils.sh |
| 80 | + add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER |
| 81 | + export GIT_VER=$(git describe --always) |
| 82 | + echo "PIP install requirements..." |
| 83 | + pip3 install --user -r ./docs/requirements.txt |
| 84 | + echo "Building the Docs..." |
| 85 | + cd ./docs && build-docs -l en |
| 86 | + echo "Deploy the Docs..." |
| 87 | + deploy-docs |
0 commit comments