From a3e8421de899c6a79576c7fd9938e913c0019bcf Mon Sep 17 00:00:00 2001 From: Suren Gabrielyan Date: Wed, 1 Mar 2023 18:21:38 +0400 Subject: [PATCH] update esp_modem to use esp_docs migrated docs from github pages to docs.espressif.com --- .github/workflows/publish-docs.yml | 77 ++++++++++++++++++++++++++++++ docs/utils.sh | 18 +++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/workflows/publish-docs.yml create mode 100644 docs/utils.sh diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 000000000..ae376e1fd --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,77 @@ +name: Docs and Publish New + +on: + push: + +env: + DOCS_DEPLOY_URL_BASE: "${{ secrets.DOCS_PREVIEW_SERVER_URL }}" + #DOCS_DEPLOY_SERVER: "ci.espressif.cn:42348" + DOCS_DEPLOY_SERVER: "ci.espressif.cn:42348" + DOCS_DEPLOY_SERVER_USER: "${{ secrets.DOCS_SERVER_USER }}" + DOCS_DEPLOY_PRIVATEKEY : "${{ secrets.DOCS_DEPLOY_KEY }}" + DOCS_DEPLOY_KEY: "${{ secrets.DOCS_DEPLOY_KEY }}" + DOCS_DEPLOY_PATH : "${{ secrets.DOCS_PATH }}" + +jobs: + docs_build: + name: Docs-Build-And-Upload + runs-on: ubuntu-latest + # Skip running on forks since it won't have access to secrets + #if: github.repository == 'espressif/esp-protocols' + steps: + - name: Checkout esp-protocols + uses: actions/checkout@master + with: + persist-credentials: false + fetch-depth: 0 + submodules: recursive + - name: Generate and delploying docs + shell: bash + run: | + sudo apt-get update + sudo apt-get -y install doxygen clang python3-pip + python -m pip install breathe recommonmark esp-docs + cd $GITHUB_WORKSPACE/components/esp_websocket_client/docs + ./generate_docs + source $GITHUB_WORKSPACE/docs/utils.sh + add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER + export GIT_VER=$(git describe --always) + ls -l $GITHUB_WORKSPACE/components/esp_websocket_client/docs + export DOCS_BUILD_DIR=$GITHUB_WORKSPACE/components/esp_websocket_client/docs + deploy-docs + +#build_docs: +# stage: build +# image: $ESP_DOCS_ENV_IMAGE +# tags: +# - build_docs +# artifacts: +# when: always +# paths: +# - docs/_build/*/*/*.txt +# - docs/_build/*/*/html/* +# expire_in: 4 days +# # No cleaning when the artifacts +# after_script: [] +# script: +# - cd docs +# - pip install -r requirements.txt +# - build-docs -l en -t esp32 +# +#.deploy_docs_template: +# stage: deploy +# image: $ESP_DOCS_ENV_IMAGE +# tags: +# - deploy_docs +# needs: +# - build_docs +# only: +# changes: +# - "docs/**/*" +# script: +# - source ${CI_PROJECT_DIR}/docs/utils.sh +# - add_doc_server_ssh_keys ${{ secrets.DOCS_DEPLOY_PRIVATEKEY }} ${{ secrets.DOCS_DEPLOY_SERVER }} ${{ secrets.DOCS_DEPLOY_SERVER_USER }} +# - export GIT_VER=$(git describe --always) +# - pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt +# - deploy-docs +# diff --git a/docs/utils.sh b/docs/utils.sh new file mode 100644 index 000000000..84f374899 --- /dev/null +++ b/docs/utils.sh @@ -0,0 +1,18 @@ +# Bash helper functions for adding SSH keys + +function add_ssh_keys() { + local key_string="${1}" + mkdir -p ~/.ssh + chmod 700 ~/.ssh + echo -n "${key_string}" >~/.ssh/id_rsa_base64 + base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa +} + +function add_doc_server_ssh_keys() { + local key_string="${1}" + local server_url="${2}" + local server_user="${3}" + add_ssh_keys "${key_string}" + echo -e "Host ${server_url}\n\tStrictHostKeyChecking no\n\tUser ${server_user}\n" >>~/.ssh/config +}