Commit d51fce52 authored by Elias Häußler's avatar Elias Häußler 🐛 Committed by Elias Häußler

[FEATURE] Add Gitlab CI configuration

parent 26cb6c75
Pipeline #43 passed with stages
in 42 seconds
image: composer:1
cache:
paths:
- docs/cache/
- vendor/
stages:
- test
- build
- deploy
build:
stage: build
script:
- composer install
- sh sbin/generate_documentation.sh
test:
stage: test
before_script:
- cp .php_cs.dist .php_cs
script:
- sh sbin/php-cs-fixer.sh --dry-run --diff
deploy:
stage: deploy
variables:
REMOTE_HOST: "${REMOTE_USER}@${REMOTE_HOSTNAME}"
before_script:
# Remote target configuration
- cp remote.env.dist remote.env
- sed -i "s|TARGET_HOST=.*|TARGET_HOST=$REMOTE_HOST|g" remote.env
- sed -i "s|TARGET_PATH=.*|TARGET_PATH=$REMOTE_PATH|g" remote.env
- sed -i "s|TARGET_PORT=.*|TARGET_PORT=$REMOTE_PORT|g" remote.env
- cat remote.env
# Environment configuration
- apk add rsync --update
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | ssh-add -
- ssh-keyscan -p ${REMOTE_PORT} ${REMOTE_HOSTNAME} >> ~/.ssh/known_hosts
script:
- find . -type d -exec chmod 755 {} \;
- sh sbin/deploy.sh
only:
- master
......@@ -6,6 +6,10 @@ Version numbers are based on [Semantic Versioning](https://semver.org).
## [Unreleased]
### Added
- Support for Gitlab CI
### Updated
- Use optimized composer autoloader for production
......
[![license](https://img.shields.io/github/license/eliashaeussler/api.svg)](LICENSE)
[![release](https://img.shields.io/github/release/eliashaeussler/api.svg)](https://github.com/eliashaeussler/api/releases/)
[![pipeline status](http://gitlab.elias-haeussler.de/eliashaeussler/api/badges/master/pipeline.svg)](http://gitlab.elias-haeussler.de/eliashaeussler/api/commits/master)
# elias-haeussler.de API
......
......@@ -57,13 +57,14 @@ rsync -arq --delete --delete-excluded --port ${TARGET_PORT} "${ROOT_PATH}"/ ${TA
--exclude /temp \
--exclude /.php_cs* \
--exclude /.sami_config.php \
--exclude /docs/cache
--exclude /docs/cache \
--exclude /docs/__build__ \
--exclude /.gitlab-ci.yml
output " Done." ${SUCCESS}
# Set new release on remote
ssh ${TARGET_HOST} -p ${TARGET_PORT} -T << __EOF
$(typeset -f output)
typeset -f output
set -e
# Create revision and version file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment