Improve build system; add _build/github-clone.sh
This commit is contained in:
parent
a9eee00950
commit
fad5d869ee
@ -22,15 +22,14 @@ DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
|
|||||||
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages"
|
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages"
|
||||||
|
|
||||||
# clone repo
|
# clone repo
|
||||||
echo "Cloning repo..."
|
github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH"
|
||||||
git clone --branch="$DEPLOY_REPO_BRANCH" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOYMENT_DIR"
|
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
cd "$DEPLOYMENT_DIR"
|
cd "$DEPLOYMENT_DIR"
|
||||||
echo
|
|
||||||
|
|
||||||
# setup repo
|
# setup repo
|
||||||
github-setup.sh
|
github-setup.sh
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# generate phpDocs
|
# generate phpDocs
|
||||||
generate-phpdoc.sh \
|
generate-phpdoc.sh \
|
||||||
@ -44,6 +43,7 @@ generate-phpdoc.sh \
|
|||||||
update-phpdoc-list.sh \
|
update-phpdoc-list.sh \
|
||||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \
|
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \
|
||||||
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
|
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# commit phpDocs
|
# commit phpDocs
|
||||||
echo "Committing changes..."
|
echo "Committing changes..."
|
||||||
|
@ -20,15 +20,14 @@ DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
|
|||||||
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages"
|
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages"
|
||||||
|
|
||||||
# clone repo
|
# clone repo
|
||||||
echo "Cloning repo..."
|
github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH"
|
||||||
git clone --branch="$DEPLOY_REPO_BRANCH" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOYMENT_DIR"
|
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
cd "$DEPLOYMENT_DIR"
|
cd "$DEPLOYMENT_DIR"
|
||||||
echo
|
|
||||||
|
|
||||||
# setup repo
|
# setup repo
|
||||||
github-setup.sh
|
github-setup.sh
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# generate phpDocs
|
# generate phpDocs
|
||||||
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
||||||
@ -43,6 +42,7 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
|||||||
update-phpdoc-list.sh \
|
update-phpdoc-list.sh \
|
||||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \
|
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \
|
||||||
"$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)"
|
"$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)"
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# commit phpDocs
|
# commit phpDocs
|
||||||
echo "Committing phpDoc changes..."
|
echo "Committing phpDoc changes..."
|
||||||
@ -60,6 +60,7 @@ if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then
|
|||||||
generate-badge.sh \
|
generate-badge.sh \
|
||||||
"$DEPLOYMENT_DIR/badges/pico-version.svg" \
|
"$DEPLOYMENT_DIR/badges/pico-version.svg" \
|
||||||
"release" "$TRAVIS_TAG" "blue"
|
"release" "$TRAVIS_TAG" "blue"
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# commit version badge
|
# commit version badge
|
||||||
echo "Committing version badge..."
|
echo "Committing version badge..."
|
||||||
@ -76,6 +77,7 @@ if [ "$DEPLOY_VERSION_FILE" == "true" ]; then
|
|||||||
update-version-file.sh \
|
update-version-file.sh \
|
||||||
"$DEPLOYMENT_DIR/_data/version.yml" \
|
"$DEPLOYMENT_DIR/_data/version.yml" \
|
||||||
"${TRAVIS_TAG#v}"
|
"${TRAVIS_TAG#v}"
|
||||||
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# commit version file
|
# commit version file
|
||||||
echo "Committing version file..."
|
echo "Committing version file..."
|
||||||
|
33
_build/github-clone.sh
Executable file
33
_build/github-clone.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##
|
||||||
|
# Clones a Git repo
|
||||||
|
#
|
||||||
|
# @author Daniel Rudolf
|
||||||
|
# @link http://picocms.org
|
||||||
|
# @license http://opensource.org/licenses/MIT
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# parameters
|
||||||
|
CLONE_TARGET_DIR="$1" # target directory
|
||||||
|
CLONE_REPO_URL="$2" # URL of the git repo to clone
|
||||||
|
CLONE_REPO_BRANCH="$3" # optional branch to checkout
|
||||||
|
|
||||||
|
# print parameters
|
||||||
|
echo "Cloning repo..."
|
||||||
|
printf 'CLONE_TARGET_DIR="%s"\n' "$CLONE_TARGET_DIR"
|
||||||
|
printf 'CLONE_REPO_URL="%s"\n' "$CLONE_REPO_URL"
|
||||||
|
printf 'CLONE_REPO_BRANCH="%s"\n' "$CLONE_REPO_BRANCH"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# clone repo
|
||||||
|
git clone "$CLONE_REPO_URL" "$CLONE_TARGET_DIR"
|
||||||
|
|
||||||
|
# checkout branch
|
||||||
|
if [ -n "$CLONE_REPO_BRANCH" ]; then
|
||||||
|
git checkout "$CLONE_REPO_BRANCH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
Loading…
x
Reference in New Issue
Block a user