From 95e45598701b5e7da82fb5ce456b76f8ed0d0de4 Mon Sep 17 00:00:00 2001 From: JiaoShuntian Date: Wed, 28 Jan 2026 09:22:24 +0800 Subject: [PATCH] backpatch some pr from ivyorysql 5 doc --- .github/workflows/merge-build-push.yml | 121 ++++++++++++++++++++++- CN/modules/ROOT/pages/master/4.1.adoc | 2 +- CN/modules/ROOT/pages/master/6.3.12.adoc | 2 +- EN/modules/ROOT/pages/master/4.1.adoc | 2 +- EN/modules/ROOT/pages/master/6.3.12.adoc | 2 +- 5 files changed, 123 insertions(+), 6 deletions(-) diff --git a/.github/workflows/merge-build-push.yml b/.github/workflows/merge-build-push.yml index 90cadadd..3ce108db 100644 --- a/.github/workflows/merge-build-push.yml +++ b/.github/workflows/merge-build-push.yml @@ -4,17 +4,24 @@ on: pull_request_target: types: - closed + create: + workflow_dispatch: + inputs: + source_branch: + required: false + default: "" jobs: build-and-deploy: runs-on: ubuntu-latest - if: github.event.pull_request.merged == true + if: github.event_name == 'workflow_dispatch' || github.event_name == 'create' || github.event.pull_request.merged == true permissions: contents: write pull-requests: write steps: - name: PR was merged + if: github.event.pull_request.number != '' run: | echo "PR #${{ github.event.pull_request.number }} was merged into ${{ github.event.pull_request.base.ref }}." echo "Head commit was: ${{ github.event.pull_request.head.sha }}" @@ -23,6 +30,7 @@ jobs: uses: actions/checkout@v4 with: path: ivorysql_doc + ref: ${{ inputs.source_branch || github.ref }} - name: Checkout Doc Builder Repository (doc_builder) uses: actions/checkout@v4 @@ -91,13 +99,68 @@ jobs: fi done + - name: Pin PDF assembler to merged PR branch + working-directory: ./ivory-doc-builder + env: + MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }} + COMPONENT_NAME: ivorysql-doc + run: | + if [[ -z "${MERGED_BRANCH}" ]]; then + echo "::error::Merged branch name is empty, cannot update PDF component version." + exit 1 + fi + + TARGET_COMPONENT_VERSION="${MERGED_BRANCH}@${COMPONENT_NAME}" + echo "Setting antora-assembler.yml component_versions to ${TARGET_COMPONENT_VERSION}" + yq -i ".component_versions = \"${TARGET_COMPONENT_VERSION}\"" antora-assembler.yml + echo "Updated antora-assembler.yml:" + cat antora-assembler.yml + - name: Checkout Web Repository (web) uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/ivorysql_web path: www_publish_target token: ${{ secrets.WEB_TOKEN }} - + + - name: Ensure web index redirects to latest home + id: update_web_index + working-directory: ./www_publish_target + env: + LATEST_VERSION: ${{ steps.latest_version_step.outputs.version }} + MERGED_PR_BASE: ${{ github.event.pull_request.base.ref || github.ref_name }} + run: | + set -euo pipefail + + TARGET_BRANCH="v${LATEST_VERSION}" + EXPECTED_PATH="ivorysql-doc/v${LATEST_VERSION}/v${LATEST_VERSION}/welcome.html" + + if [[ "${MERGED_PR_BASE}" != "${TARGET_BRANCH}" ]]; then + echo "Base branch ${MERGED_PR_BASE} is not the latest version branch ${TARGET_BRANCH}, skip index redirect check." + echo "index_updated=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + UPDATE_NEEDED=false + for lang in cn en; do + FILE_PATH="docs/${lang}/index.html" + if [[ ! -f "${FILE_PATH}" ]]; then + echo "Missing ${FILE_PATH}, cannot update redirect." + continue + fi + + if grep -q "${EXPECTED_PATH}" "${FILE_PATH}"; then + echo "${FILE_PATH} already points to latest ${LATEST_VERSION}." + else + # Replace all version segments like vX.Y or vX.Y.Z in href/location/meta/script targets + sed -i -E "s@ivorysql-doc/v[0-9]+(\\.[0-9]+){1,2}/v[0-9]+(\\.[0-9]+){1,2}/welcome\\.html@${EXPECTED_PATH}@g" "${FILE_PATH}" + UPDATE_NEEDED=true + echo "Updated ${FILE_PATH} to latest ${LATEST_VERSION} redirect." + fi + done + + echo "index_updated=${UPDATE_NEEDED}" >> "$GITHUB_OUTPUT" + - name: Setup Ruby and Bundler uses: ruby/setup-ruby@v1 with: @@ -127,12 +190,66 @@ jobs: ls ../www_publish_target/ npx antora generate --stacktrace --to-dir ../www_publish_target/docs/en antora-playbook-EN.yml + - name: Copy English PDF export into web repo + working-directory: ./ivory-doc-builder + env: + MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }} + COMPONENT_NAME: ivorysql-doc + run: | + set -euo pipefail + + if [[ -z "${MERGED_BRANCH}" ]]; then + echo "::error::Merged branch name is empty, cannot locate PDF output." + exit 1 + fi + + SOURCE_PDF_EN="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf" + DEST_EN="../www_publish_target/docs/en/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf" + + if [[ ! -f "${SOURCE_PDF_EN}" ]]; then + echo "::error::English PDF not found at ${SOURCE_PDF_EN}" + exit 1 + fi + + echo "Copying English PDF from ${SOURCE_PDF_EN} to web repo target..." + mkdir -p "$(dirname "${DEST_EN}")" + cp "${SOURCE_PDF_EN}" "${DEST_EN}" + echo "English PDF copied to:" + echo " - ${DEST_EN}" + - name: Build Chinese Documentation working-directory: ./ivory-doc-builder run: | echo "Building Chinese site..." npx antora generate --stacktrace --to-dir ../www_publish_target/docs/cn antora-playbook-CN.yml + - name: Copy Chinese PDF export into web repo + working-directory: ./ivory-doc-builder + env: + MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }} + COMPONENT_NAME: ivorysql-doc + run: | + set -euo pipefail + + if [[ -z "${MERGED_BRANCH}" ]]; then + echo "::error::Merged branch name is empty, cannot locate PDF output." + exit 1 + fi + + SOURCE_PDF="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf" + DEST_CN="../www_publish_target/docs/cn/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf" + + if [[ ! -f "${SOURCE_PDF}" ]]; then + echo "::error::PDF not found at ${SOURCE_PDF}" + exit 1 + fi + + echo "Copying PDF from ${SOURCE_PDF} to web repo targets..." + mkdir -p "$(dirname "${DEST_CN}")" + cp "${SOURCE_PDF}" "${DEST_CN}" + echo "PDF copied to:" + echo " - ${DEST_CN}" + - name: Commit and Push to web Repository new branch , pull request id: commit_push_new_branch working-directory: ./www_publish_target diff --git a/CN/modules/ROOT/pages/master/4.1.adoc b/CN/modules/ROOT/pages/master/4.1.adoc index 3818f811..34d722d6 100644 --- a/CN/modules/ROOT/pages/master/4.1.adoc +++ b/CN/modules/ROOT/pages/master/4.1.adoc @@ -89,7 +89,7 @@ $ sudo yum --disablerepo=* localinstall *.rpm == 源码安装 ** 安装依赖 ``` -$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel +$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel uuid-devel $ sudo dnf groupinstall -y 'Development Tools' ``` ** 获取IvorySQL源代码 diff --git a/CN/modules/ROOT/pages/master/6.3.12.adoc b/CN/modules/ROOT/pages/master/6.3.12.adoc index 96d405bc..a0d55c92 100644 --- a/CN/modules/ROOT/pages/master/6.3.12.adoc +++ b/CN/modules/ROOT/pages/master/6.3.12.adoc @@ -129,7 +129,7 @@ typedef enum IvyStmtType { IVY_STMT_UNKNOW, IVY_STMT_DO, - IVY_STMT_DOFROMCALL, /* new statementt type */ + IVY_STMT_DOFROMCALL, /* new statement type */ IVY_STMT_DOHANDLED, IVY_STMT_OTHERS } IvyStmtType; diff --git a/EN/modules/ROOT/pages/master/4.1.adoc b/EN/modules/ROOT/pages/master/4.1.adoc index aad96b6a..cf6c9494 100644 --- a/EN/modules/ROOT/pages/master/4.1.adoc +++ b/EN/modules/ROOT/pages/master/4.1.adoc @@ -90,7 +90,7 @@ IvorySQL then will be installed in the /usr/ivory-5/ directory. == Source code installation ** Installing dependencies ``` -$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel +$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel uuid-devel $ sudo dnf groupinstall -y 'Development Tools' ``` ** Getting source code diff --git a/EN/modules/ROOT/pages/master/6.3.12.adoc b/EN/modules/ROOT/pages/master/6.3.12.adoc index 6ee5244c..125a1515 100644 --- a/EN/modules/ROOT/pages/master/6.3.12.adoc +++ b/EN/modules/ROOT/pages/master/6.3.12.adoc @@ -136,7 +136,7 @@ typedef enum IvyStmtType { IVY_STMT_UNKNOW, IVY_STMT_DO, - IVY_STMT_DOFROMCALL, /* new statementt type */ + IVY_STMT_DOFROMCALL, /* new statement type */ IVY_STMT_DOHANDLED, IVY_STMT_OTHERS } IvyStmtType;