Skip to content

readme improvement

readme improvement #22

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 -czf docs.tar.gz ./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 }}" | base64 -d > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking no" > ~/.ssh/config
ssh-keyscan -H ${{ secrets.DOCS_PROD_SERVER }} >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- name: Create remote directory
run: ssh -o BatchMode=yes ${{ secrets.DOCS_PROD_SERVER_USER }}@${{ secrets.DOCS_PROD_SERVER }} "mkdir -p ${{ secrets.DOCS_PROD_PATH }}"
- name: Copy tarball to server
run: |
scp -B docs/docs.tar.gz ${{ secrets.DOCS_PROD_SERVER_USER }}@${{ secrets.DOCS_PROD_SERVER }}:${{ secrets.DOCS_PROD_PATH }}/docs.tar.gz
- name: Extract and cleanup
run: |
TARBALL_NAME=$(basename docs/docs.tar.gz)
ssh -o BatchMode=yes ${{ secrets.DOCS_PROD_SERVER_USER }}@${{ secrets.DOCS_PROD_SERVER }} "cd ${{ secrets.DOCS_PROD_PATH }} && \
rm -rf ./*/${{ github.event.inputs.version }} && \
tar -zxvf ${TARBALL_NAME} && \
rm -rf ./en && \
mkdir -p ./en/latest && \
cp -r ./book/* ./en/latest/ && \
rm -rf ./book && \
rm ${TARBALL_NAME}"
- name: Cleanup SSH key
if: always()
run: rm -f ~/.ssh/id_rsa