Skip to content

add documentation to docs.espressif.com #8

add documentation to docs.espressif.com

add documentation to docs.espressif.com #8

Workflow file for this run

on:
release:
types:
- created
push:
branches:
- master
- release/*
paths:
- "docs/**"
- ".github/workflows/docs_build.yml"
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs_build.yml"
workflow_dispatch:
jobs:
build-and-deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: "0.4.43"
- name: Build the book
run: |
cd docs && ls -la
git clone https://github.com/espressif/esp-docs-mdbook.git
cp -r ./esp-docs-mdbook/theme ./theme
rm -rf ./esp-docs-mdbook
mdbook build
zip -r docs.zip ./book/
tar -cvf docs.tar ./book/
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: eim-docs
path: docs/docs.zip
if-no-files-found: error
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DOCS_PROD_PRIVATEKEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.DOCS_PROD_SERVER }} >> ~/.ssh/known_hosts
- name: Create remote directory
run: ssh -o BatchMode=yes ${{ secrets.DOCS_PROD_SERVER }} "mkdir -p ${{ secrets.DOCS_PROD_PATH }}"
- name: Copy tarball to server
run: scp -B docs/docs.tar ${{ secrets.DOCS_PROD_SERVER }}:${{ secrets.DOCS_PROD_PATH }}
- name: Extract and cleanup
run: |
TARBALL_NAME=$(basename docs/docs.tar)
ssh -o BatchMode=yes ${{ secrets.DOCS_PROD_SERVER }} "cd ${{ secrets.DOCS_PROD_PATH }} && \
rm -rf ./*/${{ github.event.inputs.version }} && \
tar -zxvf ${TARBALL_NAME} && \
rm ${TARBALL_NAME}"
- name: Cleanup SSH key
if: always()
run: rm -f ~/.ssh/id_rsa