2018-03-19 13:04:09 +01:00
image : framasoft/framadate-ci
2017-12-14 15:30:21 +01:00
stages :
2018-02-20 08:43:46 +01:00
- test
2017-12-14 15:30:21 +01:00
- deploy
2018-03-28 16:50:00 +02:00
- beta
2017-12-14 15:30:21 +01:00
- funky
2018-02-20 08:43:46 +01:00
# Run php-cs-fixer and phpunit on all branches
test :
stage : test
script :
2018-03-19 13:06:31 +01:00
- composer install -o --no-interaction --no-progress --prefer-dist
2018-02-20 08:43:46 +01:00
- php vendor/bin/php-cs-fixer fix --verbose --dry-run
- vendor/bin/phpunit --bootstrap app/tests/bootstrap.php --debug app/tests
2018-02-20 08:58:49 +01:00
cache :
paths :
- vendor/
2018-02-20 08:43:46 +01:00
# Create artifacts on master
pages :
stage : deploy
2017-12-14 15:30:21 +01:00
script :
- latesttag=$(git describe --tags)
- git checkout ${latesttag}
2018-03-19 13:06:31 +01:00
- composer install -o --no-interaction --no-progress --prefer-dist --no-dev
- composer dump-autoload --optimize --no-dev --classmap-authoritative
2018-03-19 10:45:35 +01:00
- mkdir framadate
2018-03-19 11:09:12 +01:00
- mv `ls -A | grep -v framadate` ./framadate
2021-10-21 09:42:38 +02:00
- echo $latesttag > framadate/VERSION
2018-08-03 14:06:23 +02:00
- find framadate/ -type d -exec chmod 750 {} \;
- find framadate/ -type f -exec chmod 640 {} \;
2019-01-07 08:44:36 +01:00
- rm -rf framadate/.git
2019-05-02 10:15:02 +02:00
- export RELEASE_ZIP="framadate-${CI_COMMIT_TAG}.zip"
- zip -r $RELEASE_ZIP framadate
2017-12-14 15:30:21 +01:00
- mkdir .public
2019-05-02 10:15:02 +02:00
- cp $RELEASE_ZIP .public/latest.zip
2017-12-14 15:30:21 +01:00
- mv .public public
2019-01-07 10:00:13 +01:00
- if [[ -z $GITLAB_API_TOKEN ]]; then exit; fi
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}"
- export RELEASE_URL="${DESCRIPTION_URL}/release"
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
2019-05-02 10:15:02 +02:00
- export artifactUrl=$(curl -s --request POST --header "${HEADER}" --form "file=@${RELEASE_ZIP}" "${PROJECT_API_URL}/uploads" | jq .url)
- export artifactAbsoluteUrl="${CI_PROJECT_URL}${artifactUrl}"
2019-01-07 10:00:13 +01:00
- export description=$(curl -s --header "${HEADER}" "${DESCRIPTION_URL}" | jq .release.description | sed -e 's@"@@g')
2019-05-02 10:15:02 +02:00
- if [[ $description == 'null' ]]; then export METHOD="POST"; echo -e 'You can download the release zip here:'" [${RELEASE_ZIP}](${artifactAbsoluteUrl})" > /tmp/text; fi
- if [[ $description != 'null' ]]; then export METHOD="PUT"; echo -e "${description}\n\n"'You can download the release zip here:'" [${RELEASE_ZIP}](${artifactAbsoluteUrl})" > /tmp/text; fi
2019-01-07 10:00:13 +01:00
- curl -s --request $METHOD --data-urlencode "description@/tmp/text" --header "${HEADER}" "${RELEASE_URL}"
2019-05-02 10:15:02 +02:00
- curl -s --request POST --header "${HEADER}" --data name="${RELEASE_ZIP}" --data url="${artifactAbsoluteUrl}" "${PROJECT_API_URL}/releases/${CI_COMMIT_TAG}/assets/links"
2017-12-14 15:30:21 +01:00
artifacts :
paths :
- public
only :
2018-04-10 21:56:01 +02:00
- tags
except :
- (beta|alpha)
2018-02-19 00:38:51 +01:00
2018-03-28 16:50:00 +02:00
# Deploy on develop
2018-03-28 16:55:04 +02:00
beta :
2018-03-28 16:50:00 +02:00
stage : beta
script :
- git checkout develop
- composer install -o --no-interaction --no-progress --prefer-dist --no-dev
- composer dump-autoload --optimize --no-dev --classmap-authoritative
2018-04-05 10:46:55 +02:00
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make pull-locales; fi
2018-03-28 16:50:00 +02:00
- mkdir .public
- cp -r * .public
2018-04-02 11:32:08 +02:00
- cp -r .git .public
2018-03-28 16:50:00 +02:00
- mv .public public
- mkdir "${HOME}/.ssh"
- chmod 700 "${HOME}/.ssh"
- if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
- eval `ssh-agent -s`
- if [ ! -z ${BETA_KEY+x} ]; then ssh-add <(echo "${BETA_KEY}" | base64 --decode -i); fi
- if [ ! -z ${BETA_KEY+x} ]; then rsync -a --delete --exclude admin/.stdout.log --exclude admin/.htpasswd --exclude app/inc/config.php --exclude stats/ --exclude error/ public/ ${BETA_USER}@${DEPLOYEMENT_HOST}:../../web/; fi
only :
- develop
2018-02-20 08:43:46 +01:00
# Deploy on funky
2017-12-14 15:30:21 +01:00
funky :
stage : funky
script :
- git checkout funky
2018-03-19 13:06:31 +01:00
- composer install
2017-12-14 15:30:21 +01:00
- mkdir tpl_c
- mkdir .public
- cp -r * .public
- mv .public public
- mkdir "${HOME}/.ssh"
- chmod 700 "${HOME}/.ssh"
- if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
- eval `ssh-agent -s`
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i); fi
2018-02-21 11:36:27 +01:00
- if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then rsync -a --delete --exclude admin/.stdout.log --exclude admin/.htpasswd --exclude app/inc/config.php --exclude stats/ --exclude error/ public/ ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/; fi
2017-12-14 15:30:21 +01:00
only :
- funky
2018-02-28 09:43:53 +01:00
# Push new translations strings to https://trad.framasoft.org
trads :
stage : deploy
image : framasoft/push-trad:latest
script :
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
- if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make push-locales; fi
only :
- develop