Travis CI: Additionally create .zip release archives

This commit is contained in:
Daniel Rudolf 2019-08-29 16:42:18 +02:00
parent c9a3f84673
commit 641cae849b
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
2 changed files with 27 additions and 10 deletions

View file

@ -5,10 +5,15 @@ export PATH="$PICO_TOOLS_DIR:$PATH"
. "$PICO_TOOLS_DIR/functions/parse-version.sh.inc"
# parameters
ARCHIVE="$1" # release archive file name
ARCHIVE_DIR="$1" # directory to create release archives in
ARCHIVE_FILENAME="$2" # release archive file name (without file extension)
if [ -z "$ARCHIVE" ]; then
echo "Unable to create release archive: No file name specified" >&2
if [ -z "$ARCHIVE_DIR" ] || [ "$(realpath "$ARCHIVE_DIR")" == "$(realpath "$PICO_BUILD_DIR")" ]; then
echo "Unable to create release archives: Invalid release archive target dir '$ARCHIVE_DIR'" >&2
exit 1
fi
if [ -z "$ARCHIVE_FILENAME" ]; then
echo "Unable to create release archives: No release archive file name given" >&2
exit 1
fi
@ -69,14 +74,24 @@ find plugins/ -type d -path 'plugins/*/.git' -print0 | xargs -0 rm -rf
echo
# create release archive
echo "Creating release archive '$ARCHIVE'..."
# create release archives
echo "Creating release archive '$ARCHIVE.tar.gz'..."
if [ -e "$ARCHIVE" ]; then
echo "Unable to create release archive: File exists" >&2
if [ -e "$ARCHIVE_DIR/$ARCHIVE.tar.gz" ]; then
echo "Unable to create release archive: File '$ARCHIVE.tar.gz' exists" >&2
exit 1
fi
find . -mindepth 1 -maxdepth 1 -printf '%f\0' \
| xargs -0 -- tar -czf "$ARCHIVE" --
| xargs -0 -- tar -czf "$ARCHIVE_DIR/$ARCHIVE.tar.gz" --
echo
echo "Creating release archive '$ARCHIVE.zip'..."
if [ -e "$ARCHIVE_DIR/$ARCHIVE.zip" ]; then
echo "Unable to create release archive: File '$ARCHIVE.zip' exists" >&2
exit 1
fi
zip -q -r "$ARCHIVE_DIR/$ARCHIVE.zip" .
echo

View file

@ -34,11 +34,13 @@ jobs:
- deploy.sh
before_deploy:
- '[ "$TRAVIS_TAG" == "v$(php -r "require_once(\"lib/Pico.php\"); echo Pico::VERSION;")" ]'
- create-release.sh "$TRAVIS_BUILD_DIR/pico-release-$TRAVIS_TAG.tar.gz"
- create-release.sh "$TRAVIS_BUILD_DIR" "pico-release-$TRAVIS_TAG"
deploy:
provider: releases
api_key: ${GITHUB_OAUTH_TOKEN}
file: pico-release-$TRAVIS_TAG.tar.gz
file:
- pico-release-$TRAVIS_TAG.tar.gz
- pico-release-$TRAVIS_TAG.zip
skip_cleanup: true
name: Version ${TRAVIS_TAG:1}
draft: true