Skip to content

Merge pull request #9175 from kenjis/docs-changelog-4.5.6 #1267

Merge pull request #9175 from kenjis/docs-changelog-4.5.6

Merge pull request #9175 from kenjis/docs-changelog-4.5.6 #1267

# When changes are pushed to the develop branch,
# build the current version of the User Guide
# with Sphinx and deploy it to the gh-pages branch.
#
# @todo Consolidate checkouts
name: Deploy User Guide (latest)
on:
push:
branches:
- 'develop'
paths:
- 'user_guide_src/**'
permissions:
contents: read
jobs:
build:
name: Deploy to gh-pages
permissions:
# Allow ad-m/github-push-action to push commit to branch gh-pages
contents: write
if: (github.repository == 'codeigniter4/CodeIgniter4')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
# Build the latest User Guide
- name: Build with Sphinx
uses: ammaraskar/[email protected]
with:
docs-folder: user_guide_src/
- name: Add "Edit this page" links
run: |
cd user_guide_src
# Fix permissions
sudo chown -R runner:docker build/html/
php add-edit-this-page build/html/
# Create an artifact of the html output
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: HTML Documentation
path: user_guide_src/build/html/
# Commit changes to the gh-pages branch
- name: Commit changes
run: |
git clone https://github.com/codeigniter4/CodeIgniter4.git --branch gh-pages --single-branch gh-pages
cp -r user_guide_src/build/html/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "${GITHUB_ACTOR}"
git add .
# Ignore failures due to lack of changes
git commit -m "Update User Guide" -a || true
- name: Push changes
uses: ad-m/[email protected]
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.ACCESS_TOKEN }}