Refactor phpDoc auto-deployment
This commit is contained in:
parent
e79388118c
commit
7f4ad75245
4
.gitignore
vendored
4
.gitignore
vendored
@ -10,6 +10,10 @@ desktop.ini
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
._*
|
._*
|
||||||
|
|
||||||
|
# Travis
|
||||||
|
/build/phpdoc-*/
|
||||||
|
/build/phpdoc-*.git/
|
||||||
|
|
||||||
# Composer
|
# Composer
|
||||||
composer.lock
|
composer.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
|
13
.travis.yml
13
.travis.yml
@ -12,14 +12,11 @@ script:
|
|||||||
- find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null
|
- find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null
|
||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
# Generate API documentation
|
- composer install
|
||||||
- sh -c "php $TRAVIS_BUILD_DIR/vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG --ignore '*/vendor/*'"
|
- ./vendor/bin/phpdoc -d . -i 'vendor/*' -i 'plugins/*' -f 'plugins/DummyPlugin.php' -t "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" --title "Pico 1.0 API Documentation ($TRAVIS_TAG)"
|
||||||
# Send documentation to Github Pages
|
- ./build/deploy-phpdoc.sh "picocms/Pico" "gh-pages" "$GITHUB_OAUTH_TOKEN" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG"
|
||||||
- sh -c "bash $TRAVIS_BUILD_DIR/build/deploy-phpdoc.sh;"
|
- composer install --no-dev
|
||||||
# remove req-dev depenedencies
|
- tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php
|
||||||
- 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:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Modified from: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
|
|
||||||
|
|
||||||
# Exit with nonzero exit code if anything fails
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Clone Pico, then create & checkout gh-pages branch
|
# parameters
|
||||||
git clone -b gh-pages "https://github.com/picocms/Pico.git $TRAVIS_BUILD_DIR/build/Pico"
|
GITHUB_PROJECT="$1" # GitHub repo (e.g. picocms/Pico)
|
||||||
|
GITHUB_BRANCH="$2" # branch to use (e.g. gh-pages)
|
||||||
|
GITHUB_OAUTH_TOKEN="$3" # see https://github.com/settings/tokens
|
||||||
|
SOURCE_DIR="$4" # absolute path to phpDocs target directory
|
||||||
|
TARGET_DIR="$5" # relative path within the specified GitHub repo
|
||||||
|
|
||||||
# Inside this git repo we'll pretend to be a new user
|
# clone repo
|
||||||
|
GIT_DIR="$(dirname "$0")/$(basename "$SOURCE_DIR").git"
|
||||||
|
git clone -b "$GITHUB_BRANCH" "https://github.com/$GITHUB_PROJECT.git" "$GIT_DIR"
|
||||||
|
|
||||||
|
# setup git
|
||||||
|
cd "$GIT_DIR"
|
||||||
git config user.name "Travis CI"
|
git config user.name "Travis CI"
|
||||||
git config user.email "travis-ci@picocms.org"
|
git config user.email "travis-ci@picocms.org"
|
||||||
|
|
||||||
#copy new files to release number
|
# copy phpdoc
|
||||||
cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/$TRAVIS_TAG
|
[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory exists" && exit 1
|
||||||
#move old master files to old-stable
|
cp -R "$SOURCE_DIR" "$TARGET_DIR"
|
||||||
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
|
# commit changes
|
||||||
git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/*
|
git add "$TARGET_DIR"
|
||||||
|
git commit -m "Add phpDocumentor class docs for Pico $TRAVIS_TAG"
|
||||||
|
|
||||||
# Commit the files with our commit message
|
# push changes
|
||||||
git commit -m "Update Documentation for Pico $TRAVIS_TAG"
|
git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/$GITHUB_PROJECT.git" "$GITHUB_BRANCH:$GITHUB_BRANCH" > /dev/null 2>&1
|
||||||
|
|
||||||
# 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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user