Skip to content

Commit 330fc9c

Browse files
authored
docs: switch the user guide to Markdown (#10717)
* docs: remove the RST user guide * chore: deploy the user guide to GitHub Pages * chore: build the user guide with MkDocs in the release workflows
1 parent 6689079 commit 330fc9c

2,124 files changed

Lines changed: 126 additions & 69832 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ utils/ export-ignore
2121
.php-cs-fixer.dist.php export-ignore
2222
.php-cs-fixer.no-header.php export-ignore
2323
.php-cs-fixer.tests.php export-ignore
24-
.php-cs-fixer.user-guide.php export-ignore
2524
structarmed-baseline.php export-ignore
2625
structarmed.php export-ignore
2726
phpstan-baseline.php export-ignore
@@ -35,8 +34,6 @@ rector.php export-ignore
3534
AGENTS.md export-ignore
3635

3736
# source user guide
38-
user_guide_src/ export-ignore
3937
docs/ export-ignore
4038
mkdocs.yml export-ignore
41-
.nojekyll export-ignore
4239
phpdoc.dist.xml export-ignore

‎.github/scripts/deploy-userguide‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ echo "Merging files from $1 to $2"
3333
# Prepare the source
3434
cd $SOURCE
3535
git checkout master
36-
cd user_guide_src
37-
make html
38-
make epub
36+
export NO_MKDOCS_2_WARNING=1
37+
export SITE_URL=https://codeigniter.com/user_guide/
38+
mkdocs build --strict
39+
python admin/llms.py
40+
python admin/anchors.py
3941

4042
# Prepare the target
4143
cd $TARGET
@@ -49,11 +51,7 @@ cp -Rf ${SOURCE}/LICENSE ./
4951
cp -Rf ${SOURCE}/admin/userguide/. ./
5052

5153
# Copy files
52-
cp -Rf ${SOURCE}/user_guide_src/build/html ./docs
53-
cp -Rf ${SOURCE}/user_guide_src/build/epub/CodeIgniter.epub ./CodeIgniter${VERSION}.epub
54-
55-
# Ensure underscore prefixed files are published
56-
touch ${TARGET}/docs/.nojekyll
54+
cp -Rf ${SOURCE}/site ./docs
5755

5856
# Commit the changes
5957
git add .

‎.github/workflows/deploy-distributables.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ jobs:
176176
with:
177177
python-version: '3.12'
178178

179-
- name: Install Sphinx
179+
- name: Install MkDocs
180180
run: |
181181
python -m pip install --upgrade pip
182-
pip install -r ./source/user_guide_src/requirements.txt
182+
pip install -r ./source/docs/requirements.txt
183183
184184
- name: Chmod
185185
run: chmod +x ./source/.github/scripts/deploy-userguide
Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,101 @@
11
# When changes are pushed to the develop branch,
2-
# build the current version of the User Guide
3-
# with Sphinx and deploy it to the gh-pages branch.
4-
#
5-
# @todo Consolidate checkouts
2+
# build the develop and the next minor versions of the User Guide
3+
# with MkDocs and deploy them to GitHub Pages.
64
name: Deploy User Guide (latest)
75

86
on:
97
push:
108
branches:
119
- 'develop'
1210
paths:
13-
- 'user_guide_src/**'
11+
- 'docs/**'
12+
- 'mkdocs.yml'
13+
- 'admin/anchors.py'
14+
- 'admin/llms.py'
15+
- '.github/workflows/deploy-userguide-latest.yml'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
1421

1522
permissions:
1623
contents: read
1724

1825
jobs:
1926
build:
20-
name: Deploy to gh-pages
21-
permissions:
22-
# Allow push to branch gh-pages
23-
contents: write
27+
name: Build User Guide
2428
if: (github.repository == 'codeigniter4/CodeIgniter4')
2529
runs-on: ubuntu-24.04
2630
steps:
27-
- name: Checkout
31+
- name: Checkout develop
2832
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2933
with:
34+
path: develop
3035
persist-credentials: false
3136

32-
- name: Setup PHP
33-
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
37+
- name: Checkout next minor
38+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3439
with:
35-
php-version: '8.2'
36-
coverage: none
40+
ref: '4.8'
41+
path: next
42+
persist-credentials: false
3743

3844
- name: Setup Python
3945
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
4046
with:
4147
python-version: '3.12'
4248

43-
- name: Install Sphinx
49+
- name: Install MkDocs
4450
run: |
4551
python -m pip install --upgrade pip
46-
pip install -r user_guide_src/requirements.txt
52+
pip install -r develop/docs/requirements.txt
4753
48-
# Build the latest User Guide
49-
- name: Build Docs with Sphinx
50-
run: make html
51-
working-directory: user_guide_src
54+
- name: Setup Pages
55+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
5256

53-
- name: Add "Edit this page" links
57+
- name: Build the sites
58+
env:
59+
NO_MKDOCS_2_WARNING: '1'
60+
BASE_URL: https://codeigniter4.github.io/CodeIgniter4
5461
run: |
55-
cd user_guide_src
56-
# Fix permissions
57-
sudo chown -R runner:docker build/html/
58-
php add-edit-this-page build/html/
62+
mkdir pages
63+
64+
for name in develop next; do
65+
if [ ! -f "${name}/mkdocs.yml" ]; then
66+
echo "::notice::The ${name} branch has no mkdocs.yml, so it is not deployed."
67+
continue
68+
fi
69+
70+
(
71+
cd "${name}"
72+
SITE_URL="${BASE_URL}/${name}/" mkdocs build --strict
73+
python admin/llms.py
74+
python admin/anchors.py
75+
)
76+
77+
mv "${name}/site" "pages/${name}"
78+
done
79+
80+
cp develop/docs/overrides/assets/versions.json pages/versions.json
81+
echo '<!doctype html><meta http-equiv="refresh" content="0; url=develop/">' > pages/index.html
5982
60-
# Create an artifact of the html output
6183
- name: Upload artifact
62-
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
84+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
6385
with:
64-
name: HTML Documentation
65-
path: user_guide_src/build/html/
66-
67-
# Commit changes to the gh-pages branch
68-
- name: Commit changes
69-
run: |
70-
git clone https://github.com/codeigniter4/CodeIgniter4.git --branch gh-pages --single-branch gh-pages
71-
cp -r user_guide_src/build/html/* gh-pages/
72-
cd gh-pages
73-
git config --local user.email "action@github.com"
74-
git config --local user.name "${GITHUB_ACTOR}"
75-
git add .
76-
# Ignore failures due to lack of changes
77-
git commit -m "Update User Guide" -a || true
86+
path: pages
7887

79-
- name: Push changes
80-
working-directory: gh-pages
81-
env:
82-
PUSH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
83-
run: bash ${GITHUB_WORKSPACE}/.github/scripts/secure-git-push https://github.com/codeigniter4/CodeIgniter4.git HEAD:gh-pages
88+
deploy:
89+
name: Deploy to GitHub Pages
90+
needs: build
91+
runs-on: ubuntu-24.04
92+
permissions:
93+
pages: write
94+
id-token: write
95+
environment:
96+
name: github-pages
97+
url: ${{ steps.deployment.outputs.page_url }}
98+
steps:
99+
- name: Deploy
100+
id: deployment
101+
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

‎.github/workflows/test-userguide.yml‎

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# When a Pull Request is opened that modifies
22
# the User Guide source, build the User Guide
3-
# with Sphinx or MkDocs and let the contributor
3+
# with MkDocs and let the contributor
44
# know of any errors.
55
name: Test User Guide
66

77
on:
88
pull_request:
99
paths:
10-
- 'user_guide_src/**'
1110
- 'docs/**'
1211
- 'mkdocs.yml'
1312
- 'admin/anchors.py'
@@ -23,33 +22,8 @@ permissions:
2322
contents: read
2423

2524
jobs:
26-
syntax_check:
27-
name: Check User Guide syntax
28-
runs-on: ubuntu-24.04
29-
30-
steps:
31-
- name: Checkout
32-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
33-
34-
- name: Setup Python
35-
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
36-
with:
37-
python-version: '3.12'
38-
39-
- name: Install Sphinx
40-
run: |
41-
python -m pip install --upgrade pip
42-
pip install -r user_guide_src/requirements.txt
43-
44-
- name: Detect usage of tabs in RST files
45-
run: php utils/check_tabs_in_rst.php
46-
47-
- name: Build Docs with Sphinx
48-
run: make html SPHINXOPTS="-W --keep-going -w /tmp/sphinx-log"
49-
working-directory: user_guide_src
50-
5125
markdown_check:
52-
name: Check Markdown User Guide
26+
name: Check User Guide
5327
runs-on: ubuntu-24.04
5428

5529
steps:

‎.github/workflows/verify-release.yml‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# When a release is published, verify that the release pipeline delivered
22
# everything: the distributable repos, the new framework version on
3-
# Packagist, and the user guide with its ePub.
3+
# Packagist, and the user guide.
44
#
55
# Use "Run workflow" with the release tag to verify an existing release.
66
name: Verify Release
@@ -123,23 +123,21 @@ jobs:
123123
timeout-minutes: 30
124124

125125
steps:
126-
- name: Check that the ePub was added
126+
- name: Check that the user guide was added
127127
env:
128128
GH_TOKEN: ${{ github.token }}
129129
run: |
130-
version="${TAG#v}"
131-
132130
for i in $(seq 1 30); do
133-
if gh api "repos/codeigniter4/userguide/contents/CodeIgniter${version}.epub" --jq '.name' > /dev/null 2>&1; then
134-
echo "CodeIgniter${version}.epub is in the userguide repo."
131+
if gh api "repos/codeigniter4/userguide/contents/docs/llms.txt" --jq '.name' > /dev/null 2>&1; then
132+
echo "docs/llms.txt is in the userguide repo."
135133
exit 0
136134
fi
137135
138-
echo "Attempt ${i}: CodeIgniter${version}.epub is not yet in the userguide repo."
136+
echo "Attempt ${i}: docs/llms.txt is not yet in the userguide repo."
139137
sleep 30
140138
done
141139
142-
echo "Timed out waiting for CodeIgniter${version}.epub."
140+
echo "Timed out waiting for docs/llms.txt."
143141
exit 1
144142
145143
- name: Check that the user guide workflows succeeded

‎.nojekyll‎

Whitespace-only changes.

‎.php-cs-fixer.dist.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
__FILE__,
3131
__DIR__ . '/.php-cs-fixer.no-header.php',
3232
__DIR__ . '/.php-cs-fixer.tests.php',
33-
__DIR__ . '/.php-cs-fixer.user-guide.php',
3433
__DIR__ . '/preload.php',
3534
__DIR__ . '/rector.php',
3635
__DIR__ . '/spark',

‎.php-cs-fixer.user-guide.php‎

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)