Build System: Refactor source code and release archive creation
Resolves #313
This commit is contained in:
parent
1bf157049a
commit
827be2cb9c
3 changed files with 50 additions and 4 deletions
7
.gitattributes
vendored
Normal file
7
.gitattributes
vendored
Normal 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
|
|
@ -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
|
||||
|
|
42
_build/create-release-archive.sh
Executable file
42
_build/create-release-archive.sh
Executable 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
|
Loading…
Reference in a new issue