Skip to content

Commit 5e21653

Browse files
authored
Merge pull request #38 from scylladb/revert-37-revert-34-publish-manual-scripts
docs: add scripts publish docs.scylladb.com/manual
2 parents 10bf708 + 4886580 commit 5e21653

File tree

7 files changed

+122
-21
lines changed

7 files changed

+122
-21
lines changed

.github/workflows/docs-manual.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Docs / Publish docs.scylladb.com/manual"
2+
3+
env:
4+
FLAG: 'manual'
5+
6+
on:
7+
schedule:
8+
# Run daily at 00:00 UTC
9+
- cron: '0 0 * * *'
10+
workflow_dispatch:
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.repository.default_branch }}
20+
persist-credentials: false
21+
fetch-depth: 0
22+
submodules: true
23+
24+
- name: Fetch submodules latest version
25+
run: |
26+
git submodule sync
27+
git submodule update --init --remote
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: '3.10'
33+
34+
- name: Set up env
35+
run: make -C submodules/scylladb/docs FLAG="${{ env.FLAG }}" setupenv
36+
37+
- name: Build docs
38+
run: make -C submodules/scylladb/docs FLAG="${{ env.FLAG }}" multiversion
39+
40+
- name: Build redirects
41+
run: make -C submodules/scylladb/docs FLAG="${{ env.FLAG }}" redirects
42+
43+
- name: Deploy docs to GitHub Pages
44+
run: ./scripts/deploy_manual.sh
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docs-pages.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
name: "Docs / Publish"
1+
name: "Docs / Publish docs.scylladb.com"
22
# For more information,
33
# see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows
44

55
on:
66
push:
77
branches:
88
- main
9-
- 'branch-**'
109
paths:
1110
- "docs/**"
1211
workflow_dispatch:
@@ -32,6 +31,6 @@ jobs:
3231
- name: Build redirects
3332
run: make -C docs redirects
3433
- name: Deploy docs to GitHub Pages
35-
run: ./docs/_utils/deploy.sh
34+
run: ./scripts/deploy_pages.sh
3635
env:
3736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "submodules/scylladb"]
2+
path = submodules/scylladb
3+
url = https://github.com/scylladb/scylladb.git

docs/_utils/deploy.sh

-18
This file was deleted.

scripts/deploy_manual.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# Variables
4+
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
5+
GH_PAGES_DIR="gh-pages"
6+
7+
echo "Preparing docs dir..."
8+
mkdir -p $GH_PAGES_DIR
9+
cp -r ./submodules/scylladb/docs/_build/dirhtml/. $GH_PAGES_DIR
10+
11+
if git ls-remote --heads "$REPO_URL" gh-pages; then
12+
echo "Cloning existing gh-pages branch..."
13+
git clone --branch gh-pages --single-branch "$REPO_URL" "${GH_PAGES_DIR}-existing"
14+
cd "${GH_PAGES_DIR}-existing"
15+
16+
echo "Cleaning up existing content..."
17+
rm -rf manual
18+
19+
echo "Copying new documentation..."
20+
mkdir -p manual
21+
cp -a ../$GH_PAGES_DIR/. manual/
22+
23+
echo "Configuring Git..."
24+
git config --local user.email "[email protected]"
25+
git config --local user.name "GitHub Action"
26+
27+
echo "Committing and pushing changes..."
28+
git add .
29+
git commit -m "Update docs" || true
30+
git push origin gh-pages --force
31+
32+
else
33+
echo "Error: The gh-pages branch does not exist in the repository."
34+
echo "Please create a gh-pages branch in your repository and re-run the script."
35+
exit 1
36+
fi

scripts/deploy_pages.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
# Variables
4+
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
5+
GH_PAGES_DIR="gh-pages"
6+
7+
echo "Preparing docs dir..."
8+
mkdir -p $GH_PAGES_DIR
9+
cp -r ./docs/_build/dirhtml/. $GH_PAGES_DIR
10+
11+
if git ls-remote --heads "$REPO_URL" gh-pages; then
12+
echo "Cloning existing gh-pages branch..."
13+
git clone --branch gh-pages --single-branch "$REPO_URL" "${GH_PAGES_DIR}-existing"
14+
cd "${GH_PAGES_DIR}-existing"
15+
16+
echo "Cleaning up existing content..."
17+
find . -mindepth 1 -not -path './.git*' -not -path './manual*' -exec rm -rf {} +
18+
19+
echo "Copying new documentation..."
20+
cp -a ../$GH_PAGES_DIR/. .
21+
22+
echo "Configuring Git..."
23+
git config --local user.email "[email protected]"
24+
git config --local user.name "GitHub Action"
25+
26+
echo "Committing and pushing changes..."
27+
git add .
28+
git commit -m "Update docs" || true
29+
git push origin gh-pages --force
30+
else
31+
echo "Error: The gh-pages branch does not exist in the repository."
32+
echo "Please create a gh-pages branch in your repository and re-run the script."
33+
exit 1
34+
fi

submodules/scylladb

Submodule scylladb added at 4260f3f

0 commit comments

Comments
 (0)