Added build and package scripts

This commit is contained in:
Chris 2021-12-09 01:11:38 +01:00
parent eefe53a438
commit 8c6f7c1e93
5 changed files with 56 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,7 +2,5 @@
/vendor /vendor
/.phpunit.cache /.phpunit.cache
/*.phar /*.phar
/.spark
/.spark.json
/src/version /src/version
/release /release

33
.spark/package.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
VERSION="$(git describe --tags)"
PATH="$PWD/tools:$PATH"
if [ -z "$VERSION" ]; then
echo "Could not parse version from git"
exit 1
fi
mkdir -p release/$VERSION
pharlite
cp spark.phar release/$VERSION/spark.phar
cp README.md release/$VERSION/README.md
cp CHANGELOG.md release/$VERSION/CHANGELOG.md
7z a -tzip "release/$VERSION/spark-$VERSION-dist.zip" spark.phar plugins README.md CHANGELOG.md
tar cvfz "release/$VERSION/spark-$VERSION-dist.tgz" spark.phar plugins README.md CHANGELOG.md
7z a -tzip "release/$VERSION/spark-$VERSION-src.zip" bin src runtime plugins composer.json README.md CHANGELOG.md
tar cvfz "release/$VERSION/spark-$VERSION-src.tgz" bin src runtime plugins composer.json README.md CHANGELOG.md
test -d release/tmp && rm -rf release/tmp
mkdir release/tmp
cp -R spark.phar plugins README.md CHANGELOG.md release/tmp/
pushd release/tmp
makeself . ../$VERSION/spark-$VERSION-dist.run "Spark $VERSION" ./spark.phar install
popd
rm -rf release/tmp
echo -e "\e[1m[release/$VERSION]\e[0m"
ls -hl release/$VERSION

0
.spark/plugins/.gitkeep Normal file
View File

11
.spark/spark.json Normal file
View File

@ -0,0 +1,11 @@
{
"preload": [
".spark/plugins/*"
],
"scripts": {
"build": [
".spark/update-version.sh",
".spark/package.sh"
]
}
}

12
.spark/update-version.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
VERSION="$(git describe --tags)"
if [ -z "$VERSION" ]; then
echo "Could not parse version from git"
exit 1
fi
echo -e "<?php define(\"APP_VERSION\", \"$VERSION\");" > src/version
echo "[Version: $VERSION]"