Skip to content

Merge pull request #7637 from kenjis/docs-with-in-titles #34

Merge pull request #7637 from kenjis/docs-with-in-titles

Merge pull request #7637 from kenjis/docs-with-in-titles #34

# 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@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
# Build the latest User Guide
- name: Build with Sphinx
uses: ammaraskar/sphinx-action@0.4
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@v3
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 "action@github.com"
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/github-push-action@v0.6.0
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.ACCESS_TOKEN }}