From e814d300b1a80fdc92e7a62562a272d1207dae7e Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Wed, 26 Feb 2025 12:42:26 +0800 Subject: [PATCH 1/3] add taosd-doc-build workflow by charles --- .github/workflows/taosd-doc-build.yml | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/taosd-doc-build.yml diff --git a/.github/workflows/taosd-doc-build.yml b/.github/workflows/taosd-doc-build.yml new file mode 100644 index 0000000000..43767e9282 --- /dev/null +++ b/.github/workflows/taosd-doc-build.yml @@ -0,0 +1,102 @@ + +name: Reusable workflow of TDengine document buile pipelines + +on: + workflow_call: + inputs: + target_branch: + description: "Target branch name of for building the document" + required: true + type: string + + target_pr_number: + description: "PR number of target branch to merge for building the document" + required: true + type: string + +env: + DOC_WKC: "/root/doc_ci_work" + ZH_DOC_REPO: "docs.taosdata.com" + EN_DOC_REPO: "docs.tdengine.com" + TD_REPO: "TDengine" + TOOLS_REPO: "taos-tools" + +jobs: + check: + runs-on: + group: CI + labels: [self-hosted, doc-build] + outputs: + changed_files_zh: ${{ steps.set_output.outputs.changed_files_zh }} + changed_files_en: ${{ steps.set_output.outputs.changed_files_en }} + changed_files_non_doc: ${{ steps.set_output.outputs.changed_files_non_doc }} + changed_files_non_tdgpt: ${{ steps.set_output.outputs.changed_files_non_tdgpt }} + steps: + - name: Get the latest document contents from the repository + run: | + set -e + # ./.github/scripts/update_repo.sh ${{ env.DOC_WKC }}/${{ env.TD_REPO }} ${{ inputs.target_branch }} ${{ inputs.target_pr_number }} + cd ${{ env.DOC_WKC }}/${{ env.TD_REPO }} + git reset --hard + git clean -f + git remote prune origin + git fetch + git checkout ${{ inputs.target_branch }} + git pull >/dev/null + git fetch origin +refs/pull/${{ inputs.target_pr_number }}/merge + git checkout -qf FETCH_HEAD + - name: Check whether the document is changed and set output variables + id: set_output + run: | + set -e + cd ${{ env.DOC_WKC }}/${{ env.TD_REPO }} + changed_files_zh=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ inputs.tartget_branch }}`| grep "^docs/zh/" | tr '\n' ' ' || :) + changed_files_en=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ inputs.tartget_branch }}`| grep "^docs/en/" | tr '\n' ' ' || :) + changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ inputs.tartget_branch }}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | tr '\n' ' ' || :) + changed_files_non_tdgpt=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ inputs.tartget_branch }}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -Ev "forecastoperator.c|anomalywindowoperator.c|tanalytics.h|tanalytics.c|tdgpt_cases.task|analytics" | tr '\n' ' ' ||:) + echo "changed_files_zh=${changed_files_zh}" >> $GITHUB_OUTPUT + echo "changed_files_en=${changed_files_en}" >> $GITHUB_OUTPUT + echo "changed_files_non_doc=${changed_files_non_doc}" >> $GITHUB_OUTPUT + echo "changed_files_non_tdgpt=${changed_files_non_tdgpt}" >> $GITHUB_OUTPUT + + build: + needs: check + runs-on: + group: CI + labels: [self-hosted, doc-build] + if: ${{ needs.check.outputs.changed_files_zh == '' || needs.check.outputs.changed_files_en == '' }} + + steps: + - name: Get the latest document contents + run: | + set -e + #./.github/scripts/update_repo.sh ${{ env.DOC_WKC }}/${{ env.TD_REPO }} ${{ inputs.target_branch }} ${{ inputs.target_pr_number }} + cd ${{ env.DOC_WKC }}/${{ env.TD_REPO }} + git reset --hard + git clean -f + git remote prune origin + git fetch + git checkout ${{ inputs.target_branch }} + git pull >/dev/null + git fetch origin +refs/pull/${{ inputs.target_pr_number }}/merge + git checkout -qf FETCH_HEAD + + - name: Build the chinese document + if: ${{ needs.check.outputs.changed_files_zh == '' }} + run: | + cd ${{ env.DOC_WKC }}/${{ env.ZH_DOC_REPO }} + yarn ass local + yarn build + + - name: Build the english document + if: ${{ needs.check.outputs.changed_files_en == '' }} + run: | + cd ${{ env.DOC_WKC }}/${{ env.EN_DOC_REPO }} + yarn ass local + yarn build + + outputs: + changed_files_zh: ${{ needs.check.outputs.changed_files_zh }} + changed_files_en: ${{ needs.check.outputs.changed_files_en }} + changed_files_non_doc: ${{ needs.check.outputs.changed_files_non_doc }} + changed_files_non_tdgpt: ${{ needs.check.outputs.changed_files_non_tdgpt }} From 9576108c13dc7e16ad4ce09a4ec2e4e19b5d2803 Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Wed, 26 Feb 2025 14:10:56 +0800 Subject: [PATCH 2/3] Update taosd-doc-build.yml --- .github/workflows/taosd-doc-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/taosd-doc-build.yml b/.github/workflows/taosd-doc-build.yml index 43767e9282..03d8b05068 100644 --- a/.github/workflows/taosd-doc-build.yml +++ b/.github/workflows/taosd-doc-build.yml @@ -64,7 +64,7 @@ jobs: runs-on: group: CI labels: [self-hosted, doc-build] - if: ${{ needs.check.outputs.changed_files_zh == '' || needs.check.outputs.changed_files_en == '' }} + if: ${{ needs.check.outputs.changed_files_zh != '' || needs.check.outputs.changed_files_en != '' }} steps: - name: Get the latest document contents @@ -82,14 +82,14 @@ jobs: git checkout -qf FETCH_HEAD - name: Build the chinese document - if: ${{ needs.check.outputs.changed_files_zh == '' }} + if: ${{ needs.check.outputs.changed_files_zh != '' }} run: | cd ${{ env.DOC_WKC }}/${{ env.ZH_DOC_REPO }} yarn ass local yarn build - name: Build the english document - if: ${{ needs.check.outputs.changed_files_en == '' }} + if: ${{ needs.check.outputs.changed_files_en != '' }} run: | cd ${{ env.DOC_WKC }}/${{ env.EN_DOC_REPO }} yarn ass local From 4af1d27b8b2a043a3196f8b23a1621a0056eedbd Mon Sep 17 00:00:00 2001 From: WANG Xu Date: Wed, 26 Feb 2025 14:14:01 +0800 Subject: [PATCH 3/3] Update .github/workflows/taosd-doc-build.yml --- .github/workflows/taosd-doc-build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/taosd-doc-build.yml b/.github/workflows/taosd-doc-build.yml index 03d8b05068..52a35fc3d5 100644 --- a/.github/workflows/taosd-doc-build.yml +++ b/.github/workflows/taosd-doc-build.yml @@ -1,5 +1,4 @@ - -name: Reusable workflow of TDengine document buile pipelines +name: TDengine Doc Build on: workflow_call: