Release Notes
v1.2 (advanced usage)
In v1.2.x, you can use some advanced features to streamline your usage.
v1.2.0
Release date: July 11, 2024
Support pruning merged preview branches using
prune_branches.yml
orprune_preview_branches.sh
.Usage
Automatically prune merged preview branches
To keep your fork clean, you can automatically prune merged preview branches using
prune_branches.yml
orprune_preview_branches.sh
.In your fork, manually trigger the
prune_branches.yml
workflow for themain
branch. After the workflow runs, merged preview branches will be deleted from the remote repository.Prerequisites
Make sure that you have met the following requirements:
Install
jq
.Generate a GitHub personal access token with the repo scope and set it as the
GITHUB_TOKEN
environment variable value.
Execute the
prune_preview_branches.sh
script in your fork.To prune locally merged preview branches:
export DELETE_BRANCHES="local" ./prune_preview_branches.shTo prune branches in the remote repository:
export DELETE_BRANCHES="remote" ./prune_preview_branches.sh
v1.1 (scheduler management)
In v1.1.x, you can use pingcap-docsite-preview
to manage preview schedules.
v1.1.0
Release date: December 6, 2023
Support maintaining continuous synchronization with pull requests using the
sync_scheduler.yml
workflow in GitHub Actions. (close #32)Usage
Perform periodic updates
You can use the
sync_scheduler.yml
GitHub workflow to periodically update the preview content from a pull request and multiple pull requests.Suppose you have created a branch
preview/pingcap/docs/1234
to preview a PR and created a branchmulti-pr-preview
to preview multiple PRs. To periodically updatepreview/pingcap/docs/1234
every 1 hour andmulti-pr-preview
every 6 hours, configure thesync_scheduler.yml
workflow in your default branch as follows:name: Sync docs on schedule on: schedule: - cron: "0 */1 * * *" # every 1 hour - cron: "0 */6 * * *" # every 6 hours jobs: sync_scheduler: runs-on: ubuntu-latest permissions: contents: write actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout current repo uses: actions/checkout@v3 - name: Sync preview branch every 1 hour if: github.event_name == 'schedule' && github.event.schedule == '0 */1 * * *' run: | gh workflow run sync_pr.yml --ref preview/pingcap/docs/1234 - name: Sync preview branch (multiple PRs) every 6 hours if: github.event_name == 'schedule' && github.event.schedule == '0 */6 * * *' run: | gh workflow run sync_mult_prs.yml --ref multi-pr-previewFor more information, refer to Workflow syntax for GitHub Actions.
v1.0 (consistent rendering)
In v1.0.x, you can use pingcap-docsite-preview
to preview documents with rendering that matches the PingCAP documentation website.
v1.0.0
Release date: December 5, 2023
Enhance the document rendering to maintain consistency with the PingCAP documentation website by removing all
{{< copyable "..." >}}
strings in Markdown files. (close #30)
v0.4 (deployment)
In v0.4.x, you can use pingcap-docsite-preview
to build the documentation website for preview.
v0.4.0
Release date: December 5, 2023
Support deploying the documentation website using the
build.sh
script.Methods for deployment
To deploy your preview documentation website, you can choose one of the following methods:
Deploy your website using a cloud service, such as Vercel, Cloudflare Pages, and Netlify:
Deploy your website locally on your machine:
v0.3 (multiple pull requests preview)
In v0.3.x, you can use pingcap-docsite-preview
to update the documents from multiple pull requests. This feature applies to pull requests from the following repositories:
v0.3.2
Release date: December 4, 2023
(Internal change) Support running unit tests using the
run_tests.yml
workflow in GitHub Actions. (close #26)
v0.3.1
Release date: December 4, 2023
(Internal change) Support concurrently executing tests using the
test/test.py
script. (close #24)
v0.3.0
Release date: December 4, 2023
Support synchronizing documents from multiple pull requests using the
sync_mult_prs.sh
script or thesync_mult_prs.yml
workflow in GitHub Actions. (close #18)Usage
Update from multiple pull requests
You can automatically update the preview content from multiple pull requests by creating a new branch and configuring it.
Create pull requests to the following repositories:
In your fork, create a new branch from the
main
branch. Do not include apreview
prefix in the branch name.Update the configuration in the
sync_mult_prs.sh
script:To preview the following pull requests:
pingcap/docs/1234
for TiDB,pingcap/docs-cn/1234
for TiDB,pingcap/docs/5678
for TiDB Cloud, andpingcap/docs-tidb-operator/1234
for TiDB Operator, configure as follows:./sync_pr.sh preview/pingcap/docs/1234 ./sync_pr.sh preview/pingcap/docs-cn/1234 ./sync_pr.sh preview-cloud/pingcap/docs/5678 ./sync_pr.sh preview-operator/pingcap/docs-tidb-operator/1234By default, pull requests are previewed in their respective base branches. To preview in a different version, such as v1.0, when the base branch of these pull requests is
master
, configure as follows:rsync -av markdown-pages/zh/tidb/master/ markdown-pages/zh/tidb/release-1.0/ rsync -av markdown-pages/en/tidb/master/ markdown-pages/en/tidb/release-1.0/ rsync -av markdown-pages/en/tidb-in-kubernetes/master/ markdown-pages/en/tidb-in-kubernetes/release-1.0/ rsync -av markdown-pages/zh/tidb-in-kubernetes/master/ markdown-pages/zh/tidb-in-kubernetes/release-1.0/Manually trigger the
sync_mult_prs.yml
workflow formulti-pr-preview
branch. Then, the workflow updates the content from these pull requests.
Prerequisites
Make sure that you have met the following requirements:
Install
jq
.Generate a GitHub personal access token with the repo scope and set it as the
GITHUB_TOKEN
environment variable value.
Create pull requests to the following repositories:
In your fork, create a new branch from the
main
branch. Do not include apreview
prefix in the branch name.git clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview git checkout -b multi-pr-previewUpdate the configuration in the
sync_mult_prs.sh
script:To preview the following pull requests:
pingcap/docs/1234
for TiDB,pingcap/docs-cn/1234
for TiDB,pingcap/docs/5678
for TiDB Cloud, andpingcap/docs-tidb-operator/1234
for TiDB Operator, configure as follows:./sync_pr.sh preview/pingcap/docs/1234 ./sync_pr.sh preview/pingcap/docs-cn/1234 ./sync_pr.sh preview-cloud/pingcap/docs/5678 ./sync_pr.sh preview-operator/pingcap/docs-tidb-operator/1234By default, pull requests are previewed in their respective base branches. To preview in a different version, such as v1.0, when the base branch of these pull requests is
master
, configure as follows:rsync -av markdown-pages/zh/tidb/master/ markdown-pages/zh/tidb/release-1.0/ rsync -av markdown-pages/en/tidb/master/ markdown-pages/en/tidb/release-1.0/ rsync -av markdown-pages/en/tidb-in-kubernetes/master/ markdown-pages/en/tidb-in-kubernetes/release-1.0/ rsync -av markdown-pages/zh/tidb-in-kubernetes/master/ markdown-pages/zh/tidb-in-kubernetes/release-1.0/Execute the
sync_mult_prs.sh
script to update the content from these pull requests../sync_mult_prs.shThis script automatically synchronizes document changes from pull requests and commits them to the current branch. To update the remote branch with these changes, be sure to push the commits.
v0.2 (single pull request preview)
In v0.2.x, you can use pingcap-docsite-preview
to update the documents from a pull request. This feature applies to pull requests from the following repositories:
v0.2.2
Release date: November 29, 2023
Fix the issue that
sync_pr.sh
fails to work when theTEST
environment variable is unset. (close #21)
v0.2.1
Release date: November 29, 2023
Support synchronizing documents from a pull request using the
sync_pr.yml
workflow in GitHub Actions. (close #19)Usage
Create a pull request to one of the following repositories:
In your fork, create a new branch from the
main
branch following these naming conventions:Documentation
Branch naming convention
preview/pingcap/docs/{PR_NUMBER}
preview/pingcap/docs-cn/{PR_NUMBER}
preview-cloud/pingcap/docs/{PR_NUMBER}
preview-operator/pingcap/docs-tidb-operator/{PR_NUMBER}
The
sync_pr.yml
workflow is automatically triggered to update the content from the pull request.
v0.2.0
Release date: September 21, 2023
Support synchronizing documents from a pull request using
sync_pr.sh
. (close #16)Usage
Prerequisites
Make sure that you have met the following requirements:
Install
jq
.Generate a GitHub personal access token with the repo scope and set it as the
GITHUB_TOKEN
environment variable value.
Create a pull request to one of the following repositories:
In your fork, create a new branch from the
main
branch following these naming conventions:Documentation
Branch naming convention
preview/pingcap/docs/{PR_NUMBER}
preview/pingcap/docs-cn/{PR_NUMBER}
preview-cloud/pingcap/docs/{PR_NUMBER}
preview-operator/pingcap/docs-tidb-operator/{PR_NUMBER}
git clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview git checkout -b preview/pingcap/docs/{PR_NUMBER}Execute the
sync_pr.sh
script to update the content from the pull request../sync_pr.shThis script automatically synchronizes document changes from the pull request and commits them to the current branch. To update the remote branch with these changes, be sure to push the commit.
v0.1 (scaffold synchronization)
In v0.1.x, you can use pingcap-docsite-preview
to synchronize the scaffold from pingcap/docs-staging
.
v0.1.7
Release date: September 21, 2023
(Internal change) Refactor the test framework to support testing shell scripts using a configuration file
test_config.toml
. (close #12)Usage
To test a shell script, follow these steps:
Define the test configuration in
test_config.toml
. For example, to test thesync_scaffold.sh
script, configure as follows:[sync_scaffold] diff_command = "diff -qrs data actual --exclude temp --exclude '*.log' --exclude sync_scaffold.sh" test_target = "sync_scaffold.sh" [[sync_scaffold.test_cases]] name = "Sync scaffold from a commit" args = "265874160aec258f9c725b0e940bc803ca558bda" directory = "test/sync_scaffold/"Run the test using
python3 test/test.py
:$ python3 test/test.py Running Tests... 100%|█████████████████████████████████████████████████████████████████████████████| 1/1 [00:18<00:00, 18.78s/it] --------------------------------------------------Test Results-------------------------------------------------- ✅ Test Sync scaffold from a commit passed successfully Tests passed: 1 of 1 18.80s ----------------------------------------------------------------------------------------------------------------
v0.1.6
Release date: September 1, 2023
Fix the issue that the "failed to push some refs" error is reported in GitHub Actions when multiple workflows are queued. This issue is fixed by adding
concurrency
and introducing a newgit_push.sh
script. (close #13)
v0.1.5
Release date: August 21, 2023
Support synchronizing the scaffold from a specified branch or a commit to ensure the test repeatability. (close #5)
Usage
git clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview ./sync_scaffold.shgit clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview ./sync_scaffold.sh $BRANCHgit clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview ./sync_scaffold.sh $COMMIT
v0.1.4
Release date: August 21, 2023
Introduce the
TEST
environment variable to control whether to ignore thegit commit
command in thesync_scaffold.sh
script. This enhancement aims to avoid unnecessary commits during test script execution. (close #6)(Internal change) Support setting environment variables in the test framework
test_util.py
. (close #7)Exclude empty directories when executing
sync_scaffold.sh
using thersync --prune-empty-dirs
option. (close #8)
v0.1.3
Release date: July 2, 2023
Fix the "fatal: not in a git directory" error that occurs when executing the
git config user.name
command during step 4 of thesync_scaffold.yml
workflow. (fixed by #3)Fix the issue that the
git add .
command exits with an error "The following paths are ignored by one of your .gitignore files". This command is now modified togit add . || true
, allowing it to continue even if it encounters ignored files. This effectively bypasses the error and prevents the command from terminating unexpectedly. (fixed by #4)
v0.1.2
Release date: July 2, 2023
Support synchronizing the scaffold using the
sync_scaffold.yml
workflow in GitHub Actions.Usage
Update the scaffold in GitHub Actions
In your fork, the
sync_scaffold.yml
workflow can be manually triggered (workflow_dispatch
) or automatically triggered every 15 days (0 0 */15 * *
) by default.on: workflow_dispatch: schedule: - cron: "0 0 */15 * *"To modify the schedule event or add more events to trigger the workflow, you can adjust the value of
on
in thesync_scaffold.yml
file.For more information, see Events that trigger workflows.
v0.1.1
Release date: July 2, 2023
(Internal change) Introduce a test framework
test_util.py
to enhance the reliability and efficiency ofpingcap-docsite-preview
.Key features
DocSitePreviewTest._setup_test_env()
: clean up the test environment, copy the target script to the test environment, and ensure that the script can be executed.DocSitePreviewTest.execute()
: execute the target script in the test environment and save the output in thetest/.../actual
directory.DocSitePreviewTest.verify()
: compare the actual output (test/.../actual
) with the expected output (test/.../data
).
For more details, see this blog.
Add a specific test for the
sync_scaffold.sh
script:Expected output:
test/sync_scaffold/data/
Test program:
test/sync_scaffold/test_sync_scaffold.py
v0.1.0
Release date: July 2, 2023
Support synchronizing the scaffold with the latest version of
pingcap/docs-staging
using thesync_scaffold.sh
script.Concept
In the
pingcap-docsite-preview
context, scaffold refers to a specific set of elements synchronized frompingcap/docs-staging
. These elements are crucial for the structure and navigation of the documentation website. It contains the following elements:Version selection: the
docs.json
fileTable of contents: all
TOC.md
files in themarkdown-pages
directoryIndex pages: all
_index.md
files in themarkdown-pages
directoryHomepage: all
_docHome.md
files in themarkdown-pages
directory
Usage
After executing the
sync_scaffold.sh
script, it updates themarkdown-pages/
directory and thedocs.json
file.git clone https://github.com/Oreoxmt/pingcap-docsite-preview.git cd pingcap-docsite-preview git checkout v0.1.0 ./sync_scaffold.shCloning into 'temp/docs-staging'... remote: Enumerating objects: 13567, done. building file list ... done created directory markdown-pages ./ en/ en/tidb-in-kubernetes/master/TOC.md en/tidb-in-kubernetes/master/_index.md en/tidb-in-kubernetes/release-1.2/TOC.md en/tidb-in-kubernetes/release-1.2/_index.md en/tidb/master/TOC.md en/tidb/master/_docHome.md en/tidb/master/_index.md en/tidb/release-4.0/TOC.md en/tidb/release-4.0/_index.md en/tidbcloud/master/TOC.md ja/ ja/tidb/release-5.4/TOC.md ja/tidb/release-5.4/_index.md ja/tidbcloud/master/TOC.md zh/ zh/tidb-in-kubernetes/master/TOC.md zh/tidb-in-kubernetes/master/_index.md zh/tidb/master/TOC.md zh/tidb/master/_docHome.md zh/tidb/master/_index.md sent 2054843 bytes received 5750 bytes 1373728.67 bytes/sec total size is 2032431 speedup is 0.99 98 files changed, 37294 insertions(+) create mode 100644 docs.json create mode 100644 markdown-pages/en/tidb-in-kubernetes/master/TOC.md ... create mode 160000 temp/docs-stagingThis script modifies the repository as follows:
$ tree . . └── sync_scaffold.sh 0 directories, 1 file$ tree . -L 4 . ├── docs.json ├── markdown-pages │ ├── en │ │ ├── tidb │ │ │ ├── master │ │ │ ├── release-4.0 │ │ │ ├── release-5.0 │ │ │ ├── release-5.1 │ │ │ ├── release-5.2 │ │ │ ├── release-5.3 │ │ │ ├── release-5.4 │ │ │ ├── release-6.1 │ │ │ ├── release-6.5 │ │ │ ├── release-7.1 │ │ ├── tidb-data-migration │ │ │ └── release-5.3 │ │ ├── tidb-in-kubernetes │ │ │ ├── master │ │ │ ├── release-1.2 │ │ │ ├── release-1.3 │ │ │ ├── release-1.4 │ │ └── tidbcloud │ │ └── master │ ├── ja │ │ ├── tidb │ │ │ ├── release-5.4 │ │ │ ├── release-6.1 │ │ │ ├── release-6.5 │ │ │ └── release-7.1 │ │ └── tidbcloud │ │ └── master │ └── zh │ ├── tidb │ │ ├── master │ │ ├── release-4.0 │ │ ├── release-5.0 │ │ ├── release-5.1 │ │ ├── release-5.2 │ │ ├── release-5.3 │ │ ├── release-5.4 │ │ ├── release-6.1 │ │ ├── release-6.5 │ │ ├── release-7.1 │ ├── tidb-data-migration │ │ └── release-5.3 │ └── tidb-in-kubernetes │ ├── master │ ├── release-1.2 │ ├── release-1.3 │ ├── release-1.4 ├── sync_scaffold.sh └── temp └── docs-staging ├── ... 65 directories, 15 files