Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 119 additions & 2 deletions .github/workflows/merge-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CN/modules/ROOT/pages/master/4.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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源代码
Expand Down
2 changes: 1 addition & 1 deletion CN/modules/ROOT/pages/master/6.3.12.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion EN/modules/ROOT/pages/master/4.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion EN/modules/ROOT/pages/master/6.3.12.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down