Build System: Refactor source code and release archive creation

Resolves #313
This commit is contained in:
Daniel Rudolf 2016-07-24 23:35:10 +02:00
parent 1bf157049a
commit 827be2cb9c
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
3 changed files with 50 additions and 4 deletions

7
.gitattributes vendored Normal file
View file

@ -0,0 +1,7 @@
/_build export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phpcs.xml export-ignore
/.phpdoc.xml export-ignore
/.travis.yml export-ignore
/index.php.dist export-ignore

View file

@ -27,10 +27,7 @@ after_success:
before_deploy:
- deploy-phpdoc-release.sh
- composer install --no-dev --optimize-autoloader
- find vendor/ -type d -path 'vendor/*/*/.git' -print0 | xargs -0 rm -rf
- mv index.php.dist index.php
- tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE.md CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php
- create-release-archive.sh "$TRAVIS_TAG"
deploy:
provider: releases

View file

@ -0,0 +1,42 @@
#!/usr/bin/env bash
RELEASE="$1"
ARCHIVE="pico-release.tar.gz"
# install dependencies
echo "Running \`composer install\`..."
composer install --no-dev --optimize-autoloader
[ $? -eq 0 ] || exit 1
echo
# remove .git dirs
echo "Removing '.git' directories of dependencies..."
find vendor/ -type d -path 'vendor/*/*/.git' -print0 | xargs -0 rm -rf
echo
# create release archive
[ -n "$RELEASE" ] && ARCHIVE="pico-release-$RELEASE.tar.gz"
echo "Creating release archive '$ARCHIVE'..."
if [ -e "$ARCHIVE" ]; then
echo "Unable to create archive: File exists" >&2
exit 1
fi
INDEX_BACKUP="$(mktemp -u)"
mv index.php "$INDEX_BACKUP"
mv index.php.dist index.php
tar -czf "$ARCHIVE" \
README.md LICENSE.md CONTRIBUTING.md CHANGELOG.md \
composer.json composer.lock \
config content-sample lib plugins themes vendor \
.htaccess index.php
EXIT=$?
mv index.php index.php.dist
mv "$INDEX_BACKUP" index.php
echo
[ $EXIT -eq 0 ] || exit 1