mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
83 lines
2.3 KiB
YAML
83 lines
2.3 KiB
YAML
# 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
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install Sphinx
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r user_guide_src/requirements.txt
|
|
|
|
# Build the latest User Guide
|
|
- name: Build Docs with Sphinx
|
|
run: make html
|
|
working-directory: 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 "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 }}
|