mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Add apidocs action
This commit is contained in:
parent
d4d7fdffb7
commit
0c6058204c
62
.github/workflows/apidocs-action.yml
vendored
Normal file
62
.github/workflows/apidocs-action.yml
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
name: API Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'develop'
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Generate API Docs
|
||||
if: (github.repository == 'codeigniter4/CodeIgniter4')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- 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
|
||||
|
||||
# I can't get curl download this correctly. The phar file has
|
||||
# appended HTML saying it is redirected. Any clues?
|
||||
# For now, I manually downloaded the phar
|
||||
# - name: Download phpDocumentor
|
||||
# run: |
|
||||
# curl https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1/phpDocumentor.phar -o ./admin/phpDocumentor.phar
|
||||
|
||||
- name: Prepare source
|
||||
run: |
|
||||
rm -rf ./build/api*
|
||||
mkdir -p ./build/api/docs
|
||||
cd build/api
|
||||
git init
|
||||
git remote add origin https://github.com/codeigniter4/api.git
|
||||
git fetch
|
||||
git checkout master
|
||||
git reset --hard origin/master
|
||||
rm -r docs/*
|
||||
|
||||
- name: Make the new API docs
|
||||
run: |
|
||||
chmod +x ./admin/phpDocumentor.phar
|
||||
./admin/phpDocumentor.phar
|
||||
cp -R ./api/build/* ./build/api/docs
|
||||
|
||||
- name: Deploy API
|
||||
run: |
|
||||
cd ./build/api
|
||||
git config --global user.email "action@github.com"
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git add .
|
||||
git commit -m "API bot sync for ${GITHUB_SHA}"
|
||||
git push -f origin master
|
@ -18,7 +18,7 @@ mkdir -p build/api/docs
|
||||
cd build/api
|
||||
git init
|
||||
git remote add origin $UPSTREAM
|
||||
git fetch
|
||||
git fetch
|
||||
git checkout master
|
||||
git reset --hard origin/master
|
||||
rm -r docs/*
|
||||
@ -39,4 +39,4 @@ if [ $1 = "deploy" ]; then
|
||||
git add .
|
||||
git commit -S -m "APIbot synching"
|
||||
git push -f origin master
|
||||
fi
|
||||
fi
|
||||
|
BIN
admin/phpDocumentor.phar
Normal file
BIN
admin/phpDocumentor.phar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user