-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: initial commit for versioned docs action (#1429)
- Loading branch information
Showing
4 changed files
with
35,057 additions
and
9,509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## this script is to update for major/minor updates | ||
## the input version format should be like: 1.0 or 0.12 | ||
VERSION=$1 | ||
|
||
echo "Processing variables" | ||
cp variables/variables-nightly.ts variables/variables-$VERSION.ts | ||
sed -i "s/greptimedbVersion: 'v[^']*'/greptimedbVersion: 'v$VERSION.0'/" variables/variables-$VERSION.ts | ||
sed -i "s/greptimedbVersion: 'v[^']*'/greptimedbVersion: 'v$VERSION.0'/" variables/variables-nightly.ts | ||
|
||
echo "Processing localized sidebars" | ||
cp i18n/zh/docusaurus-plugin-content-docs/current.json i18n/zh/docusaurus-plugin-content-docs/version-$VERSION.json | ||
jq 'del(.["version.label"])' i18n/zh/docusaurus-plugin-content-docs/version-$VERSION.json > temp.json && mv temp.json i18n/zh/docusaurus-plugin-content-docs/version-$VERSION.json | ||
|
||
echo "Removing greptimecloud content from current version" | ||
CURRENT_VERSION=$(jq -r '.[0]' versions.json) | ||
rm -rf versioned_docs/version-$CURRENT_VERSION/greptimecloud | ||
rm -rf i18n/zh/docusaurus-plugin-content-docs/version-$CURRENT_VERSION/greptimecloud | ||
jq 'del(.docs[] | select(.label == "GreptimeCloud"))' versioned_sidebars/version-$CURRENT_VERSION-sidebars.json > temp.json && mv temp.json versioned_sidebars/version-$CURRENT_VERSION-sidebars.json | ||
sed -i '/^- \[GreptimeCloud\]/d' versioned_docs/version-$CURRENT_VERSION/index.md | ||
sed -i '/^- \[GreptimeCloud\]/d' i18n/zh/docusaurus-plugin-content-docs/version-$CURRENT_VERSION/index.md | ||
|
||
echo "Generating new version" | ||
npm run docusaurus docs:version $VERSION | ||
|
||
# echo "Removing oldest version" | ||
# OLDEST_VERSION=$(jq -r '.[-1]' versions.json) | ||
# rm -rf versioned_docs/version-$OLDEST_VERSION | ||
# rm -rf i18n/zh/docusaurus-plugin-content-docs/version-$OLDEST_VERSION/ | ||
# rm i18n/zh/docusaurus-plugin-content-docs/version-$OLDEST_VERSION.json | ||
# rm versioned_sidebars/version-$OLDEST_VERSION-sidebars.json | ||
# jq '.[:-1]' versions.json > temp.json && mv temp.json versions.json | ||
|
||
# echo "Set new default" | ||
# npm run docusaurus docs:use-version $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Version Docs | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version number without patch (e.g., 1.0 or 0.12)' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
update-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Call update scripts | ||
run: | | ||
VERSION=${{ github.event.inputs.version }} | ||
.github/scripts/release.sh $VERSION | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: "Version docs to ${{ github.event.inputs.version }}" | ||
title: "Version docs to ${{ github.event.inputs.version }}" | ||
body: "This PR updates the docs to version ${{ github.event.inputs.version }}." | ||
branch: "version-docs-${{ github.event.inputs.version }}" | ||
base: main | ||
delete-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.