58f615403e
- Separate Travis branch deployment and release deployment stages (also makes `deploy.sh` obsolete) - Add `clean.sh` and `release.sh` scripts to allow users to create "release" packages locally - Use `setup/*.sh` scripts to check and install build dependencies (like PHP_CodeSniffer, phpDocumentor and cloc) - Use `create-release.sh` of `picocms/ci-tools` to create release archives - Streamline script usage Use the following to test Pico and to create a "release" package locally: ```sh cd ~/My-Pico-Workspace/Components/pico ln -rs ../ci-tools .build/ci-tools . ./.build/ci-tools/init/local.sh.inc . ./.build/init.sh.inc phpcs --standard=.phpcs.xml "$PICO_PROJECT_DIR" clean.sh release.sh ```
44 lines
1.4 KiB
Bash
Executable file
44 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
[ -n "$PICO_BUILD_ENV" ] || { echo "No Pico build environment specified" >&2; exit 1; }
|
|
|
|
# get current Pico milestone
|
|
VERSION="$(php -r "require_once('$PICO_PROJECT_DIR/lib/Pico.php'); echo Pico::VERSION;")"
|
|
MILESTONE="Pico$([[ "$VERSION" =~ ^([0-9]+\.[0-9]+)\. ]] && echo " ${BASH_REMATCH[1]}")"
|
|
|
|
echo "Deploying $PROJECT_REPO_BRANCH branch ($MILESTONE)..."
|
|
echo
|
|
|
|
# clone repo
|
|
github-clone.sh "$PICO_DEPLOY_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH"
|
|
|
|
cd "$PICO_DEPLOY_DIR"
|
|
|
|
# setup repo
|
|
github-setup.sh
|
|
|
|
# generate phpDocs
|
|
generate-phpdoc.sh \
|
|
"$PICO_PROJECT_DIR/.phpdoc.xml" \
|
|
"$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache" "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" \
|
|
"$MILESTONE API Documentation ($PROJECT_REPO_BRANCH branch)"
|
|
|
|
if [ -z "$(git status --porcelain "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache")" ]; then
|
|
# nothing to do
|
|
exit 0
|
|
fi
|
|
|
|
# update phpDoc list
|
|
update-phpdoc-list.sh \
|
|
"$PICO_DEPLOY_DIR/_data/phpDoc.yml" \
|
|
"$PICO_DEPLOYMENT" "branch" "<code>$PROJECT_REPO_BRANCH</code> branch" "$(date +%s)"
|
|
|
|
# commit phpDocs
|
|
github-commit.sh \
|
|
"Update phpDocumentor class docs for $PROJECT_REPO_BRANCH branch @ $PROJECT_REPO_COMMIT" \
|
|
"$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache" "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" \
|
|
"$PICO_DEPLOY_DIR/_data/phpDoc.yml"
|
|
|
|
# deploy phpDocs
|
|
github-deploy.sh "$PROJECT_REPO_SLUG" "heads/$PROJECT_REPO_BRANCH" "$PROJECT_REPO_COMMIT"
|