Skip to content

Commit 12bed3e

Browse files
authored
Merge pull request #219 from jiaoshuntian/master
backpatch some pr from ivyorysql 5 doc
2 parents 107ba4a + b3e9183 commit 12bed3e

File tree

5 files changed

+123
-6
lines changed

5 files changed

+123
-6
lines changed

.github/workflows/merge-build-push.yml

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@ on:
44
pull_request_target:
55
types:
66
- closed
7+
create:
8+
workflow_dispatch:
9+
inputs:
10+
source_branch:
11+
required: false
12+
default: ""
713

814
jobs:
915
build-and-deploy:
1016
runs-on: ubuntu-latest
11-
if: github.event.pull_request.merged == true
17+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'create' || github.event.pull_request.merged == true
1218
permissions:
1319
contents: write
1420
pull-requests: write
1521

1622
steps:
1723
- name: PR was merged
24+
if: github.event.pull_request.number != ''
1825
run: |
1926
echo "PR #${{ github.event.pull_request.number }} was merged into ${{ github.event.pull_request.base.ref }}."
2027
echo "Head commit was: ${{ github.event.pull_request.head.sha }}"
@@ -23,6 +30,7 @@ jobs:
2330
uses: actions/checkout@v4
2431
with:
2532
path: ivorysql_doc
33+
ref: ${{ inputs.source_branch || github.ref }}
2634

2735
- name: Checkout Doc Builder Repository (doc_builder)
2836
uses: actions/checkout@v4
@@ -91,13 +99,68 @@ jobs:
9199
fi
92100
done
93101
102+
- name: Pin PDF assembler to merged PR branch
103+
working-directory: ./ivory-doc-builder
104+
env:
105+
MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }}
106+
COMPONENT_NAME: ivorysql-doc
107+
run: |
108+
if [[ -z "${MERGED_BRANCH}" ]]; then
109+
echo "::error::Merged branch name is empty, cannot update PDF component version."
110+
exit 1
111+
fi
112+
113+
TARGET_COMPONENT_VERSION="${MERGED_BRANCH}@${COMPONENT_NAME}"
114+
echo "Setting antora-assembler.yml component_versions to ${TARGET_COMPONENT_VERSION}"
115+
yq -i ".component_versions = \"${TARGET_COMPONENT_VERSION}\"" antora-assembler.yml
116+
echo "Updated antora-assembler.yml:"
117+
cat antora-assembler.yml
118+
94119
- name: Checkout Web Repository (web)
95120
uses: actions/checkout@v4
96121
with:
97122
repository: ${{ github.repository_owner }}/ivorysql_web
98123
path: www_publish_target
99124
token: ${{ secrets.WEB_TOKEN }}
100-
125+
126+
- name: Ensure web index redirects to latest home
127+
id: update_web_index
128+
working-directory: ./www_publish_target
129+
env:
130+
LATEST_VERSION: ${{ steps.latest_version_step.outputs.version }}
131+
MERGED_PR_BASE: ${{ github.event.pull_request.base.ref || github.ref_name }}
132+
run: |
133+
set -euo pipefail
134+
135+
TARGET_BRANCH="v${LATEST_VERSION}"
136+
EXPECTED_PATH="ivorysql-doc/v${LATEST_VERSION}/v${LATEST_VERSION}/welcome.html"
137+
138+
if [[ "${MERGED_PR_BASE}" != "${TARGET_BRANCH}" ]]; then
139+
echo "Base branch ${MERGED_PR_BASE} is not the latest version branch ${TARGET_BRANCH}, skip index redirect check."
140+
echo "index_updated=false" >> "$GITHUB_OUTPUT"
141+
exit 0
142+
fi
143+
144+
UPDATE_NEEDED=false
145+
for lang in cn en; do
146+
FILE_PATH="docs/${lang}/index.html"
147+
if [[ ! -f "${FILE_PATH}" ]]; then
148+
echo "Missing ${FILE_PATH}, cannot update redirect."
149+
continue
150+
fi
151+
152+
if grep -q "${EXPECTED_PATH}" "${FILE_PATH}"; then
153+
echo "${FILE_PATH} already points to latest ${LATEST_VERSION}."
154+
else
155+
# Replace all version segments like vX.Y or vX.Y.Z in href/location/meta/script targets
156+
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}"
157+
UPDATE_NEEDED=true
158+
echo "Updated ${FILE_PATH} to latest ${LATEST_VERSION} redirect."
159+
fi
160+
done
161+
162+
echo "index_updated=${UPDATE_NEEDED}" >> "$GITHUB_OUTPUT"
163+
101164
- name: Setup Ruby and Bundler
102165
uses: ruby/setup-ruby@v1
103166
with:
@@ -127,12 +190,66 @@ jobs:
127190
ls ../www_publish_target/
128191
npx antora generate --stacktrace --to-dir ../www_publish_target/docs/en antora-playbook-EN.yml
129192
193+
- name: Copy English PDF export into web repo
194+
working-directory: ./ivory-doc-builder
195+
env:
196+
MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }}
197+
COMPONENT_NAME: ivorysql-doc
198+
run: |
199+
set -euo pipefail
200+
201+
if [[ -z "${MERGED_BRANCH}" ]]; then
202+
echo "::error::Merged branch name is empty, cannot locate PDF output."
203+
exit 1
204+
fi
205+
206+
SOURCE_PDF_EN="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf"
207+
DEST_EN="../www_publish_target/docs/en/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf"
208+
209+
if [[ ! -f "${SOURCE_PDF_EN}" ]]; then
210+
echo "::error::English PDF not found at ${SOURCE_PDF_EN}"
211+
exit 1
212+
fi
213+
214+
echo "Copying English PDF from ${SOURCE_PDF_EN} to web repo target..."
215+
mkdir -p "$(dirname "${DEST_EN}")"
216+
cp "${SOURCE_PDF_EN}" "${DEST_EN}"
217+
echo "English PDF copied to:"
218+
echo " - ${DEST_EN}"
219+
130220
- name: Build Chinese Documentation
131221
working-directory: ./ivory-doc-builder
132222
run: |
133223
echo "Building Chinese site..."
134224
npx antora generate --stacktrace --to-dir ../www_publish_target/docs/cn antora-playbook-CN.yml
135225
226+
- name: Copy Chinese PDF export into web repo
227+
working-directory: ./ivory-doc-builder
228+
env:
229+
MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }}
230+
COMPONENT_NAME: ivorysql-doc
231+
run: |
232+
set -euo pipefail
233+
234+
if [[ -z "${MERGED_BRANCH}" ]]; then
235+
echo "::error::Merged branch name is empty, cannot locate PDF output."
236+
exit 1
237+
fi
238+
239+
SOURCE_PDF="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf"
240+
DEST_CN="../www_publish_target/docs/cn/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf"
241+
242+
if [[ ! -f "${SOURCE_PDF}" ]]; then
243+
echo "::error::PDF not found at ${SOURCE_PDF}"
244+
exit 1
245+
fi
246+
247+
echo "Copying PDF from ${SOURCE_PDF} to web repo targets..."
248+
mkdir -p "$(dirname "${DEST_CN}")"
249+
cp "${SOURCE_PDF}" "${DEST_CN}"
250+
echo "PDF copied to:"
251+
echo " - ${DEST_CN}"
252+
136253
- name: Commit and Push to web Repository new branch , pull request
137254
id: commit_push_new_branch
138255
working-directory: ./www_publish_target

CN/modules/ROOT/pages/master/compatibility_features_design/call_into.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ typedef enum IvyStmtType
129129
{
130130
IVY_STMT_UNKNOW,
131131
IVY_STMT_DO,
132-
IVY_STMT_DOFROMCALL, /* new statementt type */
132+
IVY_STMT_DOFROMCALL, /* new statement type */
133133
IVY_STMT_DOHANDLED,
134134
IVY_STMT_OTHERS
135135
} IvyStmtType;

CN/modules/ROOT/pages/master/installation_guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ $ sudo yum --disablerepo=* localinstall *.rpm
8989
== 源码安装
9090
** 安装依赖
9191
```
92-
$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel
92+
$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel uuid-devel
9393
$ sudo dnf groupinstall -y 'Development Tools'
9494
```
9595
** 获取IvorySQL源代码

EN/modules/ROOT/pages/master/compatibility_features_design/call_into.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ typedef enum IvyStmtType
136136
{
137137
IVY_STMT_UNKNOW,
138138
IVY_STMT_DO,
139-
IVY_STMT_DOFROMCALL, /* new statementt type */
139+
IVY_STMT_DOFROMCALL, /* new statement type */
140140
IVY_STMT_DOHANDLED,
141141
IVY_STMT_OTHERS
142142
} IvyStmtType;

EN/modules/ROOT/pages/master/installation_guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ IvorySQL then will be installed in the /usr/ivory-5/ directory.
9090
== Source code installation
9191
** Installing dependencies
9292
```
93-
$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel
93+
$ sudo dnf install -y bison readline-devel zlib-devel openssl-devel uuid-devel
9494
$ sudo dnf groupinstall -y 'Development Tools'
9595
```
9696
** Getting source code

0 commit comments

Comments
 (0)