-
Notifications
You must be signed in to change notification settings - Fork 1.9k
73 lines (64 loc) · 2.02 KB
/
deploy-userguide-latest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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 }}