Build system: Add tools/github-commit.sh
This commit is contained in:
parent
ae99e0c2cd
commit
da0d4c3054
@ -38,15 +38,10 @@ update-phpdoc-list.sh \
|
|||||||
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
|
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
|
||||||
|
|
||||||
# commit phpDocs
|
# commit phpDocs
|
||||||
echo "Committing changes..."
|
github-commit.sh \
|
||||||
git add --all \
|
"Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
|
||||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
|
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
|
||||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
"$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
||||||
git commit \
|
|
||||||
--message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
|
|
||||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
|
|
||||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
|
||||||
echo
|
|
||||||
|
|
||||||
# deploy phpDocs
|
# deploy phpDocs
|
||||||
github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT"
|
github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT"
|
||||||
|
@ -72,12 +72,9 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
|||||||
"$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)"
|
"$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)"
|
||||||
|
|
||||||
# commit phpDocs
|
# commit phpDocs
|
||||||
echo "Committing phpDoc changes..."
|
github-commit.sh \
|
||||||
git add --all "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
"Update phpDocumentor class docs for $TRAVIS_TAG" \
|
||||||
git commit \
|
|
||||||
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \
|
|
||||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -90,12 +87,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||||||
"release" "$TRAVIS_TAG" "blue"
|
"release" "$TRAVIS_TAG" "blue"
|
||||||
|
|
||||||
# commit version badge
|
# commit version badge
|
||||||
echo "Committing version badge..."
|
github-commit.sh \
|
||||||
git add "$DEPLOYMENT_DIR/badges/pico-version.svg"
|
"Update version badge for $TRAVIS_TAG" \
|
||||||
git commit \
|
|
||||||
--message="Update version badge for $TRAVIS_TAG" \
|
|
||||||
"$DEPLOYMENT_DIR/badges/pico-version.svg"
|
"$DEPLOYMENT_DIR/badges/pico-version.svg"
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update version file
|
# update version file
|
||||||
@ -105,12 +99,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||||||
"$VERSION_FULL"
|
"$VERSION_FULL"
|
||||||
|
|
||||||
# commit version file
|
# commit version file
|
||||||
echo "Committing version file..."
|
github-commit.sh \
|
||||||
git add "$DEPLOYMENT_DIR/_data/version.yml"
|
"Update version file for $TRAVIS_TAG" \
|
||||||
git commit \
|
|
||||||
--message="Update version file for $TRAVIS_TAG" \
|
|
||||||
"$DEPLOYMENT_DIR/_data/version.yml"
|
"$DEPLOYMENT_DIR/_data/version.yml"
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update cloc statistics
|
# update cloc statistics
|
||||||
@ -120,12 +111,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||||||
"$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
"$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
||||||
|
|
||||||
# commit cloc statistics
|
# commit cloc statistics
|
||||||
echo "Commiting cloc statistics..."
|
github-commit.sh \
|
||||||
git add "$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
"Update cloc statistics for $TRAVIS_TAG" \
|
||||||
git commit \
|
|
||||||
--message="Update cloc statistics for $TRAVIS_TAG" \
|
|
||||||
"$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
"$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
45
_build/tools/github-commit.sh
Executable file
45
_build/tools/github-commit.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##
|
||||||
|
# Commits changes to a Git repo
|
||||||
|
#
|
||||||
|
# @author Daniel Rudolf
|
||||||
|
# @link http://picocms.org
|
||||||
|
# @license http://opensource.org/licenses/MIT
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# parameters
|
||||||
|
COMMIT_MESSAGE="$1" # commit message
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
# print parameters
|
||||||
|
echo "Commiting changes..."
|
||||||
|
printf 'COMMIT_MESSAGE="%s"\n' "$COMMIT_MESSAGE"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# stage changes
|
||||||
|
COMMIT_FILES=()
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
if [ -n "$(git status --porcelain "$1")" ]; then
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
git add --all "$1"
|
||||||
|
elif [ -f "$1" ] || [ -h "$1" ]; then
|
||||||
|
git add "$1"
|
||||||
|
else
|
||||||
|
echo "Unable to commit '$1': No such file, symbolic link or directory" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMIT_FILES+=( "$1" )
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# commit changes
|
||||||
|
if [ ${#COMMIT_FILES[@]} -gt 0 ]; then
|
||||||
|
git commit --message="$COMMIT_MESSAGE" "${COMMIT_FILES[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
Loading…
x
Reference in New Issue
Block a user