diff --git a/.travis.yml b/.travis.yml index 01b5c42..2cc0f22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,13 @@ script: - find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null before_deploy: - - composer install + # Generate API documentation + - sh -c "php $TRAVIS_BUILD_DIR/vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG --ignore '*/vendor/*'" + # Send documentation to Github Pages + - sh -c "bash $TRAVIS_BUILD_DIR/build/deploy-phpdoc.sh;" + # remove req-dev depenedencies + - composer update --no-dev + # package Pico - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" .htaccess README.md CHANGELOG.md CONTRIBUTING.md composer.json composer.lock LICENSE config content-sample lib plugins themes vendor index.php deploy: @@ -26,4 +32,3 @@ deploy: php: 5.3 sudo: false - diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh new file mode 100644 index 0000000..0d447ed --- /dev/null +++ b/build/deploy-phpdoc.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Modified from: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd + +# Exit with nonzero exit code if anything fails +set -e + +# Clone Pico, then create & checkout gh-pages branch +git clone -b gh-pages "https://github.com/picocms/Pico.git $TRAVIS_BUILD_DIR/build/Pico" + +# Inside this git repo we'll pretend to be a new user +git config user.name "Travis CI" +git config user.email "travis-ci@picocms.org" + +#copy new files to release number +cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/$TRAVIS_TAG +#move old master files to old-stable +mv -f $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master $TRAVIS_BUILD_DIR/build/Pico/phpDoc/old-stable +#copy new files to master +cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master + +# Add the files to our commit +git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* + +# Commit the files with our commit message +git commit -m "Update Documentation for Pico $TRAVIS_TAG" + +# Force push from the current repo's gh-pages branch to the remote repo's gh-pages branch. +# We redirect output to /dev/null to hide any sensitive data that might otherwise be exposed. +git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/picocms/Pico.git" master:gh-pages > /dev/null 2>&1 diff --git a/composer.json b/composer.json index b0d75e1..2787259 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,9 @@ "erusev/parsedown-extra": "0.7.*", "symfony/yaml" : "2.3" }, + "require-dev" : { + "phpdocumentor/phpdocumentor": "^2.8" + }, "autoload": { "psr-0": { "Pico": "lib/",