Build system: Add tools/github-commit.sh
This commit is contained in:
parent
ae99e0c2cd
commit
da0d4c3054
3 changed files with 55 additions and 27 deletions
|
@ -38,15 +38,10 @@ update-phpdoc-list.sh \
|
|||
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)"
|
||||
|
||||
# commit phpDocs
|
||||
echo "Committing changes..."
|
||||
git add --all \
|
||||
github-commit.sh \
|
||||
"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"
|
||||
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
|
||||
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)"
|
||||
|
||||
# commit phpDocs
|
||||
echo "Committing phpDoc changes..."
|
||||
git add --all "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
||||
git commit \
|
||||
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \
|
||||
github-commit.sh \
|
||||
"Update phpDocumentor class docs for $TRAVIS_TAG" \
|
||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -90,12 +87,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||
"release" "$TRAVIS_TAG" "blue"
|
||||
|
||||
# commit version badge
|
||||
echo "Committing version badge..."
|
||||
git add "$DEPLOYMENT_DIR/badges/pico-version.svg"
|
||||
git commit \
|
||||
--message="Update version badge for $TRAVIS_TAG" \
|
||||
github-commit.sh \
|
||||
"Update version badge for $TRAVIS_TAG" \
|
||||
"$DEPLOYMENT_DIR/badges/pico-version.svg"
|
||||
echo
|
||||
fi
|
||||
|
||||
# update version file
|
||||
|
@ -105,12 +99,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||
"$VERSION_FULL"
|
||||
|
||||
# commit version file
|
||||
echo "Committing version file..."
|
||||
git add "$DEPLOYMENT_DIR/_data/version.yml"
|
||||
git commit \
|
||||
--message="Update version file for $TRAVIS_TAG" \
|
||||
github-commit.sh \
|
||||
"Update version file for $TRAVIS_TAG" \
|
||||
"$DEPLOYMENT_DIR/_data/version.yml"
|
||||
echo
|
||||
fi
|
||||
|
||||
# update cloc statistics
|
||||
|
@ -120,12 +111,9 @@ if [ "$VERSION_STABILITY" != "stable" ]; then
|
|||
"$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
||||
|
||||
# commit cloc statistics
|
||||
echo "Commiting cloc statistics..."
|
||||
git add "$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
||||
git commit \
|
||||
--message="Update cloc statistics for $TRAVIS_TAG" \
|
||||
github-commit.sh \
|
||||
"Update cloc statistics for $TRAVIS_TAG" \
|
||||
"$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml"
|
||||
echo
|
||||
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…
Add table
Reference in a new issue