feat(edgex): adapt to message v4 (#3532) #470
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Docs | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
branches: | |
- master | |
paths: | |
- 'docs/**' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'lf-edge' | |
steps: | |
- name: clone docs | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
path: docs-files | |
- name: clone frontend | |
uses: actions/checkout@main | |
with: | |
repository: 'emqx/emqx-io-docs-frontend' | |
token: ${{ secrets.CI_GIT_TOKEN }} | |
ref: next | |
path: frontend | |
- name: use python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: use node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'frontend/.nvmrc' | |
- name: use pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- name: set env | |
run: | | |
BRANCH=$(echo ${{ github.ref }} | sed -r "s ^refs/heads/|^refs/tags/(.*) \1 g") | |
if [ "$BRANCH" = "master" ];then | |
VERSION="latest" | |
else | |
VERSION=$(echo $BRANCH | sed -E 's/([^.]+\.[^.]+).*/\1/') | |
if [[ ! $VERSION =~ ^v.* ]]; then | |
VERSION="v$VERSION" | |
fi | |
fi | |
echo "DOCS_BRANCH=$BRANCH" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "DOCS_TYPE=ekuiper" >> $GITHUB_ENV | |
- name: remove unused files | |
run: | | |
cd docs-files | |
python3 .github/scripts/remove_unused.py directory.json $(pwd)/docs | |
- name: move files | |
run: | | |
rm frontend/docs/*.md || true | |
rm frontend/README.md || true | |
mkdir -p frontend/docs/en/${VERSION}/ | |
mkdir -p frontend/docs/zh/${VERSION}/ | |
mkdir -p frontend/docs/public/api/ | |
cp -r docs-files/docs/en_US/* frontend/docs/en/${VERSION}/ | |
cp -r docs-files/docs/zh_CN/* frontend/docs/zh/${VERSION}/ | |
cp docs-files/docs/directory.json frontend/docs/.vitepress/config/directory.json | |
- name: generate version config | |
run: | | |
cd docs-files | |
version_list=$(git tag | grep -E 'v?[0-9]+\.[0-9]+\.[0-9]+$' | xargs echo -n) | |
python3 .github/scripts/generate_version.py $version_list > ../frontend/docs/public/api/${DOCS_TYPE}_versions.json | |
cat ../frontend/docs/public/api/${DOCS_TYPE}_versions.json | |
- name: build docs | |
run: | | |
cd frontend | |
pnpm install | |
pnpm build | |
- name: upload dist | |
run: | | |
cd frontend/docs/.vitepress/ | |
wget https://obs-community-intl.obs.ap-southeast-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz | |
tar -xzvf obsutil_linux_amd64.tar.gz | |
mkdir obsutil | |
cp $(find . -name "obsutil_linux_amd64_*")/* obsutil/ | |
chmod 755 obsutil/obsutil | |
./obsutil/obsutil config -i=${{ secrets.HUAWEI_COMMUNITY_CI_ID }} -k=${{ secrets.HUAWEI_COMMUNITY_CI_SECRET }} -e=obs.ap-southeast-1.myhuaweicloud.com | |
./obsutil/obsutil rm -r -f obs://ekuiper.org/docs/en/${VERSION} || true | |
./obsutil/obsutil rm -r -f obs://ekuiper.org/docs/zh/${VERSION} || true | |
./obsutil/obsutil cp -r -f -flat dist/ obs://ekuiper.org/docs/ | |
- name: Refresh Huawei CDN | |
uses: Swilder-M/refresh-huawei-cdn@master | |
with: | |
access_key_id: ${{ secrets.HUAWEI_COMMUNITY_CI_ID }} | |
access_key_secret: ${{ secrets.HUAWEI_COMMUNITY_CI_SECRET }} | |
file_paths: | |
https://ekuiper.org/docs/ | |
https://ekuiper-static.emqx.net/ | |
- name: update search index | |
uses: Swilder-M/docsearch-scraper-simple@next | |
env: | |
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} | |
API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
with: | |
docs_type: ${{ env.DOCS_TYPE }} | |
docs_version: ${{ env.VERSION }} |