Commit 02a3f949 authored by Andy J's avatar Andy J

Merge branch 'master' of gitlab.jtl-software.de:jtlshop/paypal

parents f9ac85f5 c65aa5e6
stages:
- test
- cleanUpTest
- build
- deploy
- cleanUp
- stagingPre
- staging
.testingScript: &testingScript |
export CI_CONTAINER_NAME=ci-job-$CI_PROJECT_NAME-testing-$CI_COMMIT_SHA-php$PHP_VERSION_TEST_STEP
function testing() {
echo "Testing projekt in PHP $PHP_VERSION_TEST_STEP docker image..."
docker run \
--volume $(pwd):/dockerBuild \
--name="$CI_CONTAINER_NAME" \
"$CI_REGISTRY_IMAGE/php$PHP_VERSION_TEST_STEP" \
sh -c "cp -r /dockerBuild/. /jtl_paypal; bash build/scripts/tests.sh"
docker stop "$CI_CONTAINER_NAME"
docker rm -fv "$CI_CONTAINER_NAME" >/dev/null
echo "Tests finished"
}
.cleanUpTesting: &cleanUpTesting |
function failedTesting() {
export CI_CONTAINER_NAME=ci-job-$CI_PROJECT_NAME-testing-$CI_COMMIT_SHA-php$PHP_VERSION_TEST_STEP
export running=$(docker inspect -f '{{.State.Running}}' $CI_CONTAINER_NAME)
if [[ ! -z "$running" ]]; then
docker stop $CI_CONTAINER_NAME && docker rm -fv $CI_CONTAINER_NAME
fi
}
.preBuildDeployScripts: &preBuildDeployScripts |
export CI_CONTAINER_NAME=ci-job-$CI_PROJECT_NAME-build-deploy-$CI_COMMIT_SHA
export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
export BUILD_SCRIPT_PATH=build/scripts/build.sh
export DEPLOY_SCRIPT_PATH=build/scripts/deploy.sh
function dockerLogin() {
if [[ -n "$CI_USER_VAR" ]]; then
echo "Logging to GitLab Container Registry with CI credentials..."
docker login -u "$CI_USER_VAR" -p "$CI_USER_PW_VAR" "$CI_REGISTRY"
echo ""
fi
}
function buildProcess() {
echo "Building projekt in PHP 5.6 docker image..."
docker run \
-dit \
--volume $CI_PROJECT_DIR.tmp/CI_SERVER_TLS_CA_FILE:$CI_PROJECT_DIR.tmp/CI_SERVER_TLS_CA_FILE \
--volume $(pwd):/dockerBuild \
--name="$CI_CONTAINER_NAME" \
$CI_REGISTRY_IMAGE/php5.6
docker exec \
$CI_CONTAINER_NAME \
sh -c "cp -r /dockerBuild/. /jtl_paypal; bash $BUILD_SCRIPT_PATH '/jtl_paypal' $CI_COMMIT_REF_NAME"
echo "Build finished"
}
function deployProcess() {
echo "Deploying archive to build server..."
docker exec \
$CI_CONTAINER_NAME \
sh -c "bash $DEPLOY_SCRIPT_PATH $CI_PROJECT_NAME $CI_COMMIT_REF_NAME /archive /jtl_paypal"
docker cp $CI_CONTAINER_NAME:/archive/. $CI_BUILD_SERVER_ARCHIVE_PATH
docker stop "$CI_CONTAINER_NAME"
docker rm -fv "$CI_CONTAINER_NAME" >/dev/null
}
.postBuildDeployScripts: &postBuildDeployScripts |
function dockerLogout() {
if [[ -n "$CI_USER_VAR" ]]; then
echo "Logout from GitLab Container Registry with CI credentials..."
docker logout "$CI_REGISTRY"
echo ""
fi
}
.cleanUpScript: &cleanUpScript |
function failedScript() {
export CI_CONTAINER_NAME=ci-job-$CI_PROJECT_NAME-build-deploy-$CI_COMMIT_SHA
export running=$(docker inspect -f '{{.State.Running}}' $CI_CONTAINER_NAME)
if [[ ! -z "$running" ]]; then
docker stop $CI_CONTAINER_NAME && docker rm -fv $CI_CONTAINER_NAME
fi
}
.devCheckoutScripts: &devCheckoutScripts |
export FILENAME="jtl_paypal-${CI_COMMIT_REF_NAME//[\/\.]/-}";
export EXTRACTION_PATH="$RUNNER_PATH/jtl_paypal";
function downloadProcess() {
export RUNNER_PATH_ZIP="$RUNNER_PATH/$FILENAME.zip";
export DOWNLOAD_URL="https://build.jtl-shop.de/get/$FILENAME.zip";
curl -o $RUNNER_PATH_ZIP $DOWNLOAD_URL
unzip -qo $RUNNER_PATH_ZIP -d $RUNNER_PATH
rm $RUNNER_PATH_ZIP
}
function deployProcess() {
export PHP_VERSION=$1;
export BRANCH=$2;
export DEPLOY_PATH="$STAGING_USER_PATH/php$PHP_VERSION/$BRANCH/includes/plugins/jtl_paypal_dev";
sudo /usr/bin/rsync -rt -og --chown=www-data:www-data $EXTRACTION_PATH/. $DEPLOY_PATH
}
test_PHP_5.6:
stage: test
variables:
PHP_VERSION_TEST_STEP: '5.6'
script:
- *testingScript
- testing
only:
- branches
except:
- master
- /^release\/.*$/
tags:
- build
test_PHP_7.1:
stage: test
variables:
PHP_VERSION_TEST_STEP: '7.1'
script:
- *testingScript
- testing
only:
- branches
except:
- master
- /^release\/.*$/
tags:
- build
test_PHP_7.2:
stage: test
variables:
PHP_VERSION_TEST_STEP: '7.2'
script:
- *testingScript
- testing
only:
- branches
except:
- master
- /^release\/.*$/
tags:
- build
test_PHP_7.3:
stage: test
variables:
PHP_VERSION_TEST_STEP: '7.3'
script:
- *testingScript
- testing
only:
- branches
except:
- master
- /^release\/.*$/
tags:
- build
removeContainerPHP5.6:
stage: cleanUpTest
variables:
PHP_VERSION_TEST_STEP: '5.6'
script:
- *cleanUpTesting
- failedTesting
only:
- branches
except:
- master
- /^release\/.*$/
when: on_failure
tags:
- build
removeContainerPHP7.1:
stage: cleanUpTest
variables:
PHP_VERSION_TEST_STEP: '7.1'
script:
- *cleanUpTesting
- failedTesting
only:
- branches
except:
- master
- /^release\/.*$/
when: on_failure
tags:
- build
removeContainerPHP7.2:
stage: cleanUpTest
variables:
PHP_VERSION_TEST_STEP: '7.2'
script:
- *cleanUpTesting
- failedTesting
only:
- branches
except:
- master
- /^release\/.*$/
when: on_failure
tags:
- build
removeContainerPHP7.3:
stage: cleanUpTest
variables:
PHP_VERSION_TEST_STEP: '7.3'
script:
- *cleanUpTesting
- failedTesting
only:
- branches
except:
- master
- /^release\/.*$/
when: on_failure
tags:
- build
build:
stage: build
before_script:
- *preBuildDeployScripts
- dockerLogin
script:
- buildProcess
after_script:
- *postBuildDeployScripts
- dockerLogout
only:
- master
- /^release\/.*$/
- tags
tags:
- build
deploy:
stage: deploy
variables:
GIT_STRATEGY: none
before_script:
- *preBuildDeployScripts
- dockerLogin
script:
- deployProcess
- buildscript pipeline:build plugin $CI_PROJECT_NAME $CI_PROJECT_DIR $CI_COMMIT_REF_NAME $CI_COMMIT_SHA jtl_paypal
after_script:
- *postBuildDeployScripts
- dockerLogout
only:
- master
- /^release\/.*$/
- tags
when: on_success
tags:
- build
removeContainer:
stage: cleanUp
script:
- *cleanUpScript
- failedScript
only:
- master
- /^release\/.*$/
- tags
when: on_failure
tags:
- build
stagingPreDeploy:
stage: stagingPre
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- downloadProcess
only:
- master
tags:
- dev-checkout
stagingDevRelease406Php56:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 56 release-4-06
environment:
name: staging release/4.06 php 5.6
url: https://$STAGING_USER-56-release-4-06.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
stagingDevRelease406Php71:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 71 release-4-06
environment:
name: staging release/4.06 php 7.1
url: https://$STAGING_USER-71-release-4-06.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
stagingDevRelease406Php72:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 72 release-4-06
environment:
name: staging release/4.06 php 7.2
url: https://$STAGING_USER-72-release-4-06.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
stagingDevRelease406Php73:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 73 release-4-06
environment:
name: staging release/4.06 php 7.3
url: https://$STAGING_USER-73-release-4-06.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
stagingDevMasterPhp72:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 72 master
environment:
name: staging master php 7.2
url: https://$STAGING_USER-72-master.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
stagingDevMasterPhp73:
stage: staging
variables:
GIT_STRATEGY: none
script:
- *devCheckoutScripts
- deployProcess 73 master
environment:
name: staging master php 7.3
url: https://$STAGING_USER-73-master.$STAGING_DOMAIN
only:
- master
tags:
- dev-checkout
\ No newline at end of file
FROM php:5.6-alpine
WORKDIR '/jtl_paypal'
RUN mkdir /archive
RUN apk update && apk add --no-cache bash curl git gnupg patchutils wget unzip zip
RUN echo "[global]" > /usr/local/etc/php/conf.d/php.ini
RUN echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "phar.readonly=Off" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "log_errors=On" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_reporting=E_ALL" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "display_errors=1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_log=/dev/stderr" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "date.timezone=Europe/Berlin" >> /usr/local/etc/php/conf.d/php.ini
RUN cd /root \
&& wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php'); unlink('installer.sig');"
RUN chmod a+x /root/composer.phar && ln -s /root/composer.phar /usr/local/bin/composer
#ENTRYPOINT ["bash"]
\ No newline at end of file
FROM php:7.1-alpine
WORKDIR '/jtl_paypal'
RUN mkdir /archive
RUN apk update && apk add --no-cache bash curl git gnupg patchutils wget unzip zip
RUN echo "[global]" > /usr/local/etc/php/conf.d/php.ini
RUN echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "phar.readonly=Off" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "log_errors=On" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_reporting=E_ALL" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "display_errors=1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_log=/dev/stderr" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "date.timezone=Europe/Berlin" >> /usr/local/etc/php/conf.d/php.ini
RUN cd /root \
&& wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php'); unlink('installer.sig');"
RUN chmod a+x /root/composer.phar && ln -s /root/composer.phar /usr/local/bin/composer
#ENTRYPOINT ["bash"]
\ No newline at end of file
FROM php:7.2-alpine
WORKDIR '/jtl_paypal'
RUN mkdir /archive
RUN apk update && apk add --no-cache bash curl git gnupg patchutils wget unzip zip
RUN echo "[global]" > /usr/local/etc/php/conf.d/php.ini
RUN echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "phar.readonly=Off" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "log_errors=On" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_reporting=E_ALL" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "display_errors=1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_log=/dev/stderr" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "date.timezone=Europe/Berlin" >> /usr/local/etc/php/conf.d/php.ini
RUN cd /root \
&& wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php'); unlink('installer.sig');"
RUN chmod a+x /root/composer.phar && ln -s /root/composer.phar /usr/local/bin/composer
#ENTRYPOINT ["bash"]
\ No newline at end of file
FROM php:7.3-alpine
WORKDIR '/jtl_paypal'
RUN mkdir /archive
RUN apk update && apk add --no-cache bash curl git gnupg patchutils wget unzip zip
RUN echo "[global]" > /usr/local/etc/php/conf.d/php.ini
RUN echo "memory_limit=-1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "phar.readonly=Off" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "log_errors=On" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_reporting=E_ALL" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "display_errors=1" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "error_log=/dev/stderr" >> /usr/local/etc/php/conf.d/php.ini
RUN echo "date.timezone=Europe/Berlin" >> /usr/local/etc/php/conf.d/php.ini
RUN cd /root \
&& wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php'); unlink('installer.sig');"
RUN chmod a+x /root/composer.phar && ln -s /root/composer.phar /usr/local/bin/composer
#ENTRYPOINT ["bash"]
\ No newline at end of file
1. Docker installieren
2. Dockerfile anlegen
3. Bei Gitlab Container Registry anmelden: "sudo docker login gitlab.jtl-software.de:4567"
4. Dockerfile builden "sudo docker build --no-cache -f build/docker/DIR/Dockerfile -t gitlab.jtl-software.de:4567/jtlshop/paypal/IMAGENAME ."
5. Docker Image hochladen: "sudo docker push gitlab.jtl-software.de:4567/jtlshop/paypal/IMAGENAME"
6. Docker image in der gitlab.yml referenzieren.
\ No newline at end of file
#!/usr/bin/env bash
build_create()
{
# $1 repository dir
export REPOSITORY_DIR=$1;
# $2 target build version
export APPLICATION_VERSION=$2;
local PHAR_READONLY=$(php -r "print(ini_get('phar.readonly'));");
local SCRIPT_DIR="${REPOSITORY_DIR}/build/scripts";
source ${SCRIPT_DIR}/create_version_string.sh;
if [[ ${PHAR_READONLY} == 1 ]]; then
echo "In order to create a phar-archive set disable 'phar.readonly'";
exit 1;
fi
echo "Set composer version";
create_version_string ${REPOSITORY_DIR} ${APPLICATION_VERSION};
if [[ ! -z "${NEW_VERSION}" ]]; then
export APPLICATION_VERSION_STR=${NEW_VERSION};
else
export APPLICATION_VERSION_STR=${APPLICATION_VERSION};
fi
composer config version ${APPLICATION_VERSION_STR} -d ${REPOSITORY_DIR};
echo "Executing composer";
composer install --no-dev -q -d ${REPOSITORY_DIR};
}
(build_create $*)
\ No newline at end of file
#!/bin/bash
get_last_tag()
{
GREATEST_MAJOR=0;
GREATEST_MINOR=0;
GREATEST_PATCH=0;
GREATEST_GREEK="";
GREATEST_PRERELEASENUMBER=0;
TAGS=$(git ls-remote --refs --tags)
VCS_REG_TAGS="refs\\/tags\\/v?([0-9]{1,})\\.([0-9]{1,})\\.([0-9]{1,})(-(alpha|beta|rc)(\\.([0-9]{1,}))?)?";
for tag in ${TAGS}; do
if [[ ${tag} =~ ${VCS_REG_TAGS} ]]; then
if [[ ${BASH_REMATCH[1]} -gt ${GREATEST_MAJOR} ]]; then
GREATEST_MAJOR=${BASH_REMATCH[1]};
GREATEST_MINOR=${BASH_REMATCH[2]};
GREATEST_PATCH=${BASH_REMATCH[3]};
if [[ -v ${BASH_REMATCH[5]} ]]; then
GREATEST_GREEK=${BASH_REMATCH[5]};
GREATEST_PRERELEASENUMBER=${BASH_REMATCH[7]};
fi
fi
if [[ ${BASH_REMATCH[1]} -eq ${GREATEST_MAJOR} ]] && [[ ${BASH_REMATCH[2]} -gt ${GREATEST_MINOR} ]]; then
GREATEST_MINOR=${BASH_REMATCH[2]};
GREATEST_PATCH=${BASH_REMATCH[3]};
if [[ -v ${BASH_REMATCH[5]} ]]; then
GREATEST_GREEK=${BASH_REMATCH[5]};
GREATEST_PRERELEASENUMBER=${BASH_REMATCH[7]};
fi
fi
if [[ ${BASH_REMATCH[1]} -eq ${GREATEST_MAJOR} ]] && [[ ${BASH_REMATCH[2]} -eq ${GREATEST_MINOR} ]] && [[ ${BASH_REMATCH[3]} -gt ${GREATEST_PATCH} ]]; then
GREATEST_PATCH=${BASH_REMATCH[3]};
if [[ -v ${BASH_REMATCH[5]} ]]; then
GREATEST_GREEK=${BASH_REMATCH[5]};
GREATEST_PRERELEASENUMBER=${BASH_REMATCH[7]};
fi
fi
GREEK=${BASH_REMATCH[5]};
PRERELEASENUMBER=${BASH_REMATCH[7]};
if [[ ! -z "${GREEK}" ]]; then
if [[ ${BASH_REMATCH[1]} -eq ${GREATEST_MAJOR} ]] && [[ ${BASH_REMATCH[2]} -eq ${GREATEST_MINOR} ]] && [[ ${BASH_REMATCH[3]} -eq ${GREATEST_PATCH} ]] && [[ "$GREEK" > "$GREATEST_GREEK" ]]; then
GREATEST_GREEK=${GREEK};
if [[ ! -z "${PRERELEASENUMBER}" ]]; then
GREATEST_PRERELEASENUMBER=${PRERELEASENUMBER};
fi
fi
if [[ ! -z "${PRERELEASENUMBER}" ]]; then
if [[ ${BASH_REMATCH[1]} -eq ${GREATEST_MAJOR} ]] && [[ ${BASH_REMATCH[2]} -eq ${GREATEST_MINOR} ]] && [[ ${BASH_REMATCH[3]} -eq ${GREATEST_PATCH} ]] && [[ "$GREEK" == "$GREATEST_GREEK" ]] && [[ ${PRERELEASENUMBER} -gt ${GREATEST_PRERELEASENUMBER} ]]; then
GREATEST_PRERELEASENUMBER=${PRERELEASENUMBER};
fi
fi
fi
fi
done
LAST_TAG="v${GREATEST_MAJOR}.${GREATEST_MINOR}.${GREATEST_PATCH}";
if [[ ! -z "${GREATEST_GREEK}" ]]; then
LAST_TAG="${LAST_TAG}-${GREATEST_GREEK}";
if [[ ${GREATEST_PRERELEASENUMBER} -gt 0 ]]; then
LAST_TAG="${LAST_TAG}.${GREATEST_PRERELEASENUMBER}";
fi
fi
}
get_latest_patch()
{
MAJOR=$1;
MINOR=$2;
GREATEST_LATEST_PATCH=0;
TAGS=$(git ls-remote --refs --tags)
VCS_REG_TAGS="refs\\/tags\\/v?([0-9]{1,})\\.([0-9]{1,})\\.([0-9]{1,})(-(alpha|beta|rc)(\\.([0-9]{1,}))?)?";
for tag in ${TAGS}; do
if [[ ${tag} =~ ${VCS_REG_TAGS} ]]; then
if [ ${MAJOR} -eq ${BASH_REMATCH[1]} ] && [ ${MINOR} -eq ${BASH_REMATCH[2]} ]; then
if [ ${BASH_REMATCH[3]} -gt ${GREATEST_LATEST_PATCH} ]; then
GREATEST_LATEST_PATCH=${BASH_REMATCH[3]}
fi
fi
fi
done
}
create_version_string()
{
REPO_DIR=$1;
APPLICATION_VERSION=$2;
VCS_REG="release\\/([0-9]{1,})\\.([0-9]{1,})";
VERSION_REGEX="v?([0-9]{1,})\\.([0-9]{1,})\\.([0-9]{1,})(-(alpha|beta|rc)(\\.([0-9]{1,}))?)?";
if [[ ${APPLICATION_VERSION} =~ ${VERSION_REGEX} ]]; then
SHOP_VERSION_MAJOR=${BASH_REMATCH[1]};
SHOP_VERSION_MINOR=${BASH_REMATCH[2]};
SHOP_VERSION_PATCH=${BASH_REMATCH[3]};
if [[ ! -z "${BASH_REMATCH[5]}" ]]; then
SHOP_VERSION_GREEK=${BASH_REMATCH[5]};
if [[ ! -z "${BASH_REMATCH[7]}" ]]; then
SHOP_VERSION_PRERELEASENUMBER=${BASH_REMATCH[7]};
fi
fi
else
if [[ ${APPLICATION_VERSION} =~ ${VCS_REG} ]]; then
SHOP_VERSION_MAJOR=${BASH_REMATCH[1]};
SHOP_VERSION_MINOR=${BASH_REMATCH[2]};
get_latest_patch ${SHOP_VERSION_MAJOR} ${SHOP_VERSION_MINOR};
SHOP_VERSION_PATCH=$((GREATEST_LATEST_PATCH+1));
else
get_last_tag;
if [[ ${LAST_TAG} =~ ${VERSION_REGEX} ]]; then
SHOP_VERSION_MAJOR=${BASH_REMATCH[1]};
SHOP_VERSION_MINOR=${BASH_REMATCH[2]};
SHOP_VERSION_PATCH=${BASH_REMATCH[3]};
if [[ ! -z "${BASH_REMATCH[5]}" ]]; then
SHOP_VERSION_GREEK=${BASH_REMATCH[5]};
if [[ ! -z "${BASH_REMATCH[7]}" ]]; then
SHOP_VERSION_PRERELEASENUMBER=${BASH_REMATCH[7]};
fi
fi
fi
fi
fi
export NEW_VERSION="$SHOP_VERSION_MAJOR.$SHOP_VERSION_MINOR.$SHOP_VERSION_PATCH";
if [[ -v SHOP_VERSION_GREEK ]] && [[ ! -z "${SHOP_VERSION_GREEK}" ]]; then
export NEW_VERSION="$NEW_VERSION-$SHOP_VERSION_GREEK";
if [[ -v SHOP_VERSION_PRERELEASENUMBER ]] && [[ ${SHOP_VERSION_PRERELEASENUMBER} -gt 0 ]]; then
export NEW_VERSION="$NEW_VERSION.$SHOP_VERSION_PRERELEASENUMBER";
fi
fi
}
\ No newline at end of file
#!/usr/bin/env bash
PROJECT_NAME=$1;
TAG=$2;
VERSION="${TAG//[\/\.]/-}";
FILENAME="jtl_paypal-${VERSION}.zip";
ARCHIVE_PATH="${3}/${FILENAME}";
ZIP_PATH=$4;
VCS_REG_TAGS="v?([0-9]{1,})\\.([0-9]{1,})\\.([0-9]{1,})";
echo "";
echo "Create zip of build '${TAG}'...";
zip -r -q ${ARCHIVE_PATH} ${ZIP_PATH} -x \*.git* \*.idea* \*docs/* \*patch-dir-* \*tests/* \*build/* \*node_modules/* \*.asset_cs \*.php_cs \*.travis.yml \*phpunit.xml;
echo " ${FILENAME}";
echo "";
if [[ ${TAG} =~ ${VCS_REG_TAGS} ]]; then
cp -r ${ARCHIVE_PATH} ${3}/latest/jtl_paypal.zip
fi
\ No newline at end of file
#!/usr/bin/env bash
echo "Execute composer install...";
composer install -q;
echo "Excute tests...";
vendor/bin/phpunit tests;
\ No newline at end of file
{
"name": "jtlshop/paypal",