Skip to content

Commit 0c60582

Browse files
committed
Add apidocs action
1 parent d4d7fdf commit 0c60582

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

.github/workflows/apidocs-action.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: API Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'develop'
7+
8+
jobs:
9+
10+
build:
11+
name: Generate API Docs
12+
if: (github.repository == 'codeigniter4/CodeIgniter4')
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '7.2'
23+
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
24+
coverage: xdebug
25+
26+
- name: Download GraphViz for phpDocumentor
27+
run: |
28+
sudo apt-get install -yq graphviz
29+
30+
# I can't get curl download this correctly. The phar file has
31+
# appended HTML saying it is redirected. Any clues?
32+
# For now, I manually downloaded the phar
33+
# - name: Download phpDocumentor
34+
# run: |
35+
# curl https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1/phpDocumentor.phar -o ./admin/phpDocumentor.phar
36+
37+
- name: Prepare source
38+
run: |
39+
rm -rf ./build/api*
40+
mkdir -p ./build/api/docs
41+
cd build/api
42+
git init
43+
git remote add origin https://github.com/codeigniter4/api.git
44+
git fetch
45+
git checkout master
46+
git reset --hard origin/master
47+
rm -r docs/*
48+
49+
- name: Make the new API docs
50+
run: |
51+
chmod +x ./admin/phpDocumentor.phar
52+
./admin/phpDocumentor.phar
53+
cp -R ./api/build/* ./build/api/docs
54+
55+
- name: Deploy API
56+
run: |
57+
cd ./build/api
58+
git config --global user.email "[email protected]"
59+
git config --global user.name "${GITHUB_ACTOR}"
60+
git add .
61+
git commit -m "API bot sync for ${GITHUB_SHA}"
62+
git push -f origin master

admin/apibot

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mkdir -p build/api/docs
1818
cd build/api
1919
git init
2020
git remote add origin $UPSTREAM
21-
git fetch
21+
git fetch
2222
git checkout master
2323
git reset --hard origin/master
2424
rm -r docs/*
@@ -39,4 +39,4 @@ if [ $1 = "deploy" ]; then
3939
git add .
4040
git commit -S -m "APIbot synching"
4141
git push -f origin master
42-
fi
42+
fi

admin/phpDocumentor.phar

17.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)