ISSUE-337: install symfony #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Core Docs | |
on: [push, pull_request] | |
jobs: | |
make-restapi-docs: | |
name: Checkout phpList core and generate docs using `phpDocumentor` | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: 8.1 | |
extensions: mbstring, dom, fileinfo, mysql | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install current dependencies from composer.lock | |
run: composer install | |
- name: Install phpDocumentor | |
run: | | |
wget https://phpdoc.org/phpDocumentor.phar | |
chmod +x phpDocumentor.phar | |
mv phpDocumentor.phar /usr/local/bin/phpDocumentor | |
- name: Verify phpDocumentor version | |
run: phpDocumentor --version | |
- name: Generate documentation | |
run: composer run-php-documentor | |
- name: zip phpdocumentor dir | |
run: zip -r phpdocumentor.zip docs/phpdocumentor | |
- name: Upload generated doc files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: doc-files | |
path: phpdocumentor.zip | |
deploy-docs: | |
name: Deploy Core Docs. | |
runs-on: ubuntu-20.04 | |
needs: make-restapi-docs | |
steps: | |
- name: Checkout phplist/core-docs | |
uses: actions/checkout@v2 | |
with: | |
repository: phpList/core-docs | |
fetch-depth: 0 | |
token: ${{ secrets.PUSH_CORE_DOCS }} | |
- name: Restore REST API Spec | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-files | |
- name: unzip phpdocumentor | |
run: | | |
unzip phpdocumentor.zip | |
rm phpdocumentor.zip | |
- name: List Files | |
run: ls | |
- name: Sync old files with newly generated ones. | |
run: rsync -av docs/phpdocumentor/* . | |
- name: Removed temp dirs | |
run: rm -rf docs | |
- name: Check if updates/changes. | |
run: git status --porcelain > repo-changes.txt | |
- name: Check changes file | |
run: cat repo-changes.txt | |
- name: Verify updates. | |
id: allow-deploy | |
run: | | |
if [ -s repo-changes.txt ]; then echo "Updates made to documentation"; echo '::set-output name=DEPLOY::true'; else echo "No updates made to documentation deployment would be skipped."; echo '::set-output name=DEPLOY::false'; fi | |
- name: Commit changes and deply | |
if: ${{ steps.allow-deploy.outputs.DEPLOY == 'true' }} | |
run: | | |
rm repo-changes.txt | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git add . | |
git commit -s -m "phplist/core docs deployment `date`" | |
git push |