1
1
# When changes are pushed to the develop branch,
2
2
# build the current version of the API documentation
3
- # with phpDocumentor and deploy it to the api branch .
3
+ # with phpDocumentor and deploy it to codeigniter4/ api.
4
4
name : Deploy API Documentation
5
5
6
6
on :
9
9
- ' develop'
10
10
paths :
11
11
- ' system/**'
12
+ - ' .github/workflows/deploy-apidocs.yml'
12
13
13
14
jobs :
14
-
15
15
build :
16
16
name : Deploy to api
17
- if : (github.repository == 'codeigniter4/CodeIgniter4')
18
- runs-on : ubuntu-latest
17
+ if : github.repository == 'codeigniter4/CodeIgniter4'
18
+ runs-on : ubuntu-20.04
19
+
19
20
steps :
20
21
- name : Setup credentials
21
22
run : |
@@ -37,37 +38,34 @@ jobs:
37
38
- name : Setup PHP
38
39
uses : shivammathur/setup-php@v2
39
40
with :
40
- php-version : ' 7.4 '
41
- extensions : intl
41
+ php-version : ' 8.0 '
42
+ coverage : none
42
43
43
- - name : Install GraphViz for phpDocumentor
44
- run : |
45
- sudo apt install -yq graphviz
46
-
47
- - name : Download phpDocumentor
44
+ - name : Download phpDocumentor v3.1
48
45
run : |
49
46
cd ./source
50
47
curl \
51
- -L https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1 /phpDocumentor.phar \
48
+ -L https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.1.0 /phpDocumentor.phar \
52
49
-o admin/phpDocumentor.phar
53
50
54
- - name : Prepare
51
+ - name : Prepare API repo
52
+ working-directory : api
55
53
run : |
56
- cd ./api
57
- rm -rf ./api/docs*
58
- mkdir -p ./api/docs
59
54
git reset --hard master
55
+ rm -rfv docs
56
+ mkdir --parents --verbose docs
60
57
61
- - name : Build
58
+ - name : Build API in source repo
59
+ working-directory : source
62
60
run : |
63
- cd ./source
64
- chmod +x admin/phpDocumentor.phar
65
- admin/phpDocumentor.phar
61
+ php admin/phpDocumentor.phar run --ansi --verbose
66
62
cp -R ${GITHUB_WORKSPACE}/source/api/build/* ${GITHUB_WORKSPACE}/api/docs
67
63
68
- - name : Deploy
64
+ - name : Deploy to API repo
65
+ working-directory : api
69
66
run : |
70
- cd ./api
71
67
git add .
72
- git commit -m "API sync for ${GITHUB_SHA}"
73
- git push
68
+ if ! git diff-index --quiet HEAD; then
69
+ git commit -m "Updated API for commit ${GITHUB_SHA}"
70
+ git push origin master
71
+ fi
0 commit comments