Merge pull request #3183 from paulbalandan/apidocs-action

Add apidocs action
This commit is contained in:
MGatner 2020-07-04 14:32:54 -04:00 committed by GitHub
commit e9afc850c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 2 deletions

69
.github/workflows/apidocs-action.yml vendored Normal file
View File

@ -0,0 +1,69 @@
name: API Documentation
on:
push:
branches:
- 'develop'
jobs:
build:
name: Generate API Docs
if: (github.repository == 'codeigniter4/CodeIgniter4')
runs-on: ubuntu-latest
steps:
- name: Setup credentials
run: |
git config --global user.email "action@github.com"
git config --global user.name "${GITHUB_ACTOR}"
- name: Checkout source
uses: actions/checkout@v2
with:
path: source
- name: Checkout api
uses: actions/checkout@v2
with:
repository: codeigniter4/api
token: ${{ secrets.ACCESS_TOKEN }}
path: api
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
coverage: xdebug
- name: Download GraphViz for phpDocumentor
run: |
sudo apt-get install -yq graphviz
- name: Download phpDocumentor
run: |
curl \
-L https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1/phpDocumentor.phar \
-o admin/phpDocumentor.phar
- name: Prepare API
run: |
cd ./api
rm -rf ./api/docs*
mkdir -p ./api/docs
git reset --hard master
- name: Make the new API docs
run: |
cd ./source
chmod +x admin/phpDocumentor.phar
admin/phpDocumentor.phar
cp -R ${GITHUB_WORKSPACE}/source/api/build/* ${GITHUB_WORKSPACE}/api/docs
- name: Deploy API
run: |
cd ./api
git add .
git commit -m "API sync for ${GITHUB_SHA}"
git push