Skip to content

Commit 5bb6d90

Browse files
authored
Merge pull request #203 from NotHimmel/v5.1
update en pdf workflow.
2 parents 6347911 + 474d756 commit 5bb6d90

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

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

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ on:
55
types:
66
- closed
77
create:
8+
workflow_dispatch:
9+
inputs:
10+
source_branch:
11+
required: false
12+
default: ""
813

914
jobs:
1015
build-and-deploy:
1116
runs-on: ubuntu-latest
12-
if: github.event.pull_request.merged == true
17+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'create' || github.event.pull_request.merged == true
1318
permissions:
1419
contents: write
1520
pull-requests: write
1621

1722
steps:
1823
- name: PR was merged
24+
if: github.event.pull_request.number != ''
1925
run: |
2026
echo "PR #${{ github.event.pull_request.number }} was merged into ${{ github.event.pull_request.base.ref }}."
2127
echo "Head commit was: ${{ github.event.pull_request.head.sha }}"
@@ -24,6 +30,7 @@ jobs:
2430
uses: actions/checkout@v4
2531
with:
2632
path: ivorysql_doc
33+
ref: ${{ inputs.source_branch || github.ref }}
2734

2835
- name: Checkout Doc Builder Repository (doc_builder)
2936
uses: actions/checkout@v4
@@ -95,7 +102,7 @@ jobs:
95102
- name: Pin PDF assembler to merged PR branch
96103
working-directory: ./ivory-doc-builder
97104
env:
98-
MERGED_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
105+
MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }}
99106
COMPONENT_NAME: ivorysql-doc
100107
run: |
101108
if [[ -z "${MERGED_BRANCH}" ]]; then
@@ -183,16 +190,43 @@ jobs:
183190
ls ../www_publish_target/
184191
npx antora generate --stacktrace --to-dir ../www_publish_target/docs/en antora-playbook-EN.yml
185192
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+
186220
- name: Build Chinese Documentation
187221
working-directory: ./ivory-doc-builder
188222
run: |
189223
echo "Building Chinese site..."
190224
npx antora generate --stacktrace --to-dir ../www_publish_target/docs/cn antora-playbook-CN.yml
191225
192-
- name: Copy PDF exports into web repo
226+
- name: Copy Chinese PDF export into web repo
193227
working-directory: ./ivory-doc-builder
194228
env:
195-
MERGED_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
229+
MERGED_BRANCH: ${{ inputs.source_branch || github.event.pull_request.base.ref || github.ref_name }}
196230
COMPONENT_NAME: ivorysql-doc
197231
run: |
198232
set -euo pipefail
@@ -204,20 +238,17 @@ jobs:
204238
205239
SOURCE_PDF="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf"
206240
DEST_CN="../www_publish_target/docs/cn/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf"
207-
DEST_EN="../www_publish_target/docs/en/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf"
208241
209242
if [[ ! -f "${SOURCE_PDF}" ]]; then
210243
echo "::error::PDF not found at ${SOURCE_PDF}"
211244
exit 1
212245
fi
213246
214247
echo "Copying PDF from ${SOURCE_PDF} to web repo targets..."
215-
mkdir -p "$(dirname "${DEST_CN}")" "$(dirname "${DEST_EN}")"
248+
mkdir -p "$(dirname "${DEST_CN}")"
216249
cp "${SOURCE_PDF}" "${DEST_CN}"
217-
cp "${SOURCE_PDF}" "${DEST_EN}"
218250
echo "PDF copied to:"
219251
echo " - ${DEST_CN}"
220-
echo " - ${DEST_EN}"
221252
222253
- name: Commit and Push to web Repository new branch , pull request
223254
id: commit_push_new_branch

0 commit comments

Comments
 (0)