Created
April 19, 2019 10:44
-
-
Save webislife/26f719abb8d23afff4db83b8aaf97faa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variables: | |
VERSION_TASK: "2.2.1" | |
stages: | |
- spawn | |
- lint | |
- build | |
- test-build | |
- stage | |
- test-stage | |
- deploy | |
- cleanup | |
#e2e тесты фронта | |
e2e-test-stage: | |
stage: test-stage | |
tags: | |
- ssr | |
only: | |
- master | |
environment: | |
name: staging | |
script: | |
- echo "e2e test complete!" | |
#Установка зависимостей фронта | |
install-deps: | |
stage: spawn | |
tags: | |
- ssr | |
script: | |
- task up | |
only: | |
- master | |
environment: | |
name: staging | |
artifacts: | |
when: on_success | |
expire_in: 30m | |
paths: | |
- node_modules/ | |
#Линтинг сурсов | |
lint: | |
stage: lint | |
tags: | |
- ssr | |
script: | |
- task lint | |
environment: | |
name: staging | |
#Установка зависимостей фронта | |
install-deps: | |
stage: spawn | |
tags: | |
- ssr | |
script: | |
- task up | |
only: | |
- master | |
environment: | |
name: staging | |
artifacts: | |
when: on_success | |
expire_in: 30m | |
paths: | |
- node_modules/ | |
#Линтинг сурсов | |
lint: | |
stage: lint | |
tags: | |
- ssr | |
only: | |
- master | |
script: | |
- task lint | |
environment: | |
name: staging | |
dependencies: | |
- install-deps | |
#Тестирование сурсов фронта | |
test-build: | |
stage: test-build | |
only: | |
- master | |
dependencies: | |
- build-stage | |
- install-deps | |
tags: | |
- ssr | |
script: | |
- task test-build | |
environment: | |
name: staging | |
#Сборка фронта для staging | |
build-stage: | |
stage: build | |
dependencies: | |
- install-deps | |
- lint | |
only: | |
- master | |
tags: | |
- ssr | |
script: | |
- task build-production | |
artifacts: | |
when: on_success | |
expire_in: 30m | |
paths: | |
- dist/ | |
environment: | |
name: staging | |
#Доставка фронта на staging | |
deploy-stage: | |
tags: | |
- ssr | |
stage: stage | |
only: | |
- master | |
dependencies: | |
- build-stage | |
- test-build | |
script: | |
- bash ./deploy.sh $CI_USER $STAGE_HOST /etc/nginx/sites-enabled/app.conf /var/www "$SSH_KEY" staging | |
environment: | |
name: staging | |
url: http://$STAGE_HOST/ | |
#Доставка фронта на staging | |
deploy-production: | |
tags: | |
- ssr | |
stage: deploy | |
only: | |
- master | |
dependencies: | |
- build-stage | |
- deploy-stage | |
- test-build | |
- e2e-test-stage | |
script: | |
- bash ./deploy.sh $CI_USER $PRODUCTION_HOST /etc/nginx/sites-enabled/app.conf /var/www "$SSH_KEY" production | |
environment: | |
name: production | |
url: http://$PRODUCTION_HOST/ | |
#Очистка кеша после всех манипуляций в pipeline | |
clear-cache-stage: | |
tags: | |
- ssr | |
stage: cleanup | |
only: | |
- master | |
dependencies: | |
- build-stage | |
- test-build | |
- deploy-stage | |
- deploy-production | |
script: | |
- echo "Cleaning up" | |
- rm -rf "%CACHE_PATH%/%CI_PIPELINE_ID%" | |
when: always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment