|
| 1 | +name: Publish documentation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + documentation_tag: |
| 7 | + type: string |
| 8 | + required: false |
| 9 | + default: "latest" |
| 10 | + description: "Label of the documentation" |
| 11 | + publish_to_prod: |
| 12 | + type: boolean |
| 13 | + default: true |
| 14 | + publish_to_dev: |
| 15 | + type: boolean |
| 16 | + default: true |
| 17 | + |
| 18 | + workflow_call: |
| 19 | + inputs: |
| 20 | + documentation_tag: |
| 21 | + type: string |
| 22 | + required: true |
| 23 | + default: "latest" |
| 24 | + publish_to_prod: |
| 25 | + type: boolean |
| 26 | + default: true |
| 27 | + publish_to_dev: |
| 28 | + type: boolean |
| 29 | + default: true |
| 30 | + secrets: |
| 31 | + NCS_ZOOMIN_KEY: |
| 32 | + required: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + Publish_Documentation: |
| 36 | + env: |
| 37 | + DOCS_DIR: docs |
| 38 | + DOC_TAG: ${{ inputs.documentation_tag }} |
| 39 | + |
| 40 | + runs-on: ubuntu-24.04 |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: '3.12' |
| 52 | + |
| 53 | + - name: Build documentation |
| 54 | + env: |
| 55 | + ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip" |
| 56 | + run: | |
| 57 | + cd ${{env.DOCS_DIR}} |
| 58 | + ./generate_docs.sh |
| 59 | +
|
| 60 | + cp custom.properties build/html/ |
| 61 | + sed -i "s/__VERSION__/${DOC_TAG}/g" build/html/custom.properties |
| 62 | +
|
| 63 | + cp tags.yml build/html/ |
| 64 | + sed -i "s/__VERSION__/${DOC_TAG}/g" build/html/tags.yml |
| 65 | +
|
| 66 | + cd build/html |
| 67 | + zip -rq "${ARCHIVE}" . |
| 68 | +
|
| 69 | + - name: Upload build artifacts |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: documentation |
| 73 | + path: ${{env.DOCS_DIR}}/build/html/addon-aliro_${{ env.DOC_TAG }}.zip |
| 74 | + |
| 75 | + - name: Prepare Key |
| 76 | + env: |
| 77 | + NCS_ZOOMIN_KEY: ${{ secrets.NCS_ZOOMIN_KEY }} |
| 78 | + run: | |
| 79 | + mkdir -p ~/.ssh |
| 80 | + ssh-keyscan ${{ vars.NCS_ZOOMIN_SERVER }} >> ~/.ssh/known_hosts |
| 81 | + echo "$NCS_ZOOMIN_KEY" > zoomin_key |
| 82 | + chmod 600 zoomin_key |
| 83 | +
|
| 84 | + - name: Publish documentation - dev |
| 85 | + if: ${{ inputs.publish_to_dev }} |
| 86 | + env: |
| 87 | + ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip" |
| 88 | + run: | |
| 89 | + sftp -v -i zoomin_key ${{vars.NCS_ZOOMIN_USER}}@${{ vars.NCS_ZOOMIN_SERVER }} <<EOF |
| 90 | + cd ${{ vars.NCS_ZOOMIN_DEPLOY_DEV_PATH}} |
| 91 | + put ${{env.DOCS_DIR}}/build/html/${ARCHIVE} |
| 92 | + EOF |
| 93 | +
|
| 94 | + - name: Publish documentation - prod |
| 95 | + if: ${{ inputs.publish_to_prod }} |
| 96 | + env: |
| 97 | + ARCHIVE: "addon-aliro_${{ env.DOC_TAG }}.zip" |
| 98 | + run: | |
| 99 | + sftp -v -i zoomin_key ${{vars.NCS_ZOOMIN_USER}}@${{ vars.NCS_ZOOMIN_SERVER }} <<EOF |
| 100 | + cd ${{ vars.NCS_ZOOMIN_DEPLOY_PROD_PATH}} |
| 101 | + put ${{env.DOCS_DIR}}/build/html/${ARCHIVE} |
| 102 | + EOF |
0 commit comments