feat(ci): update continuous integration config

add environments, rename jobs
parent 2bcb2480
...@@ -5,68 +5,53 @@ stages: ...@@ -5,68 +5,53 @@ stages:
variables: variables:
BUILD_PATH: "www/dist" BUILD_PATH: "www/dist"
STAGING_URL: "http://staging.1.dev.1119.zolotoykod.ru"
PRODUCTION_URL: "http://production.1.dev.1119.zolotoykod.ru"
save_user_data: status:
stage: startup stage: startup
script: script:
- bash backup_bitrix.sh - git status
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
only:
- master
startup: docker:
stage: startup stage: startup
script: script:
- docker-compose up -d - docker-compose up -d
only:
- master
.build_assets: staging:
stage: build stage: build
script: script:
- docker-compose exec -T bitrix bash -c 'yarn install' - docker-compose exec -T bitrix /bin/bash /link_bx.sh /home/bitrix/site
- docker-compose exec -T bitrix bash -c 'gulp' - docker-compose exec -T bitrix /bin/bash /build.sh
cache: cache:
paths: paths:
- www/node_modules/ - www/node_modules/
- www/vendor/
environment:
name: staging
url: $STAGING_URL
artifacts: artifacts:
paths: paths:
- $BUILD_PATH - $BUILD_PATH
expire_in: 1 day expire_in: 1 day
only:
- master
.migrations: production:
stage: build
script:
- bash restore_bitrix.sh
- docker-compose exec -T bitrix bash -c 'composer update'
- docker-compose exec -T bitrix bash -c 'php migrator migrate'
cache:
paths:
- www/vendor/
deploy:
stage: deploy stage: deploy
script: script:
- bash restore_bitrix.sh - export
- echo 'Get all artifacts from previous stages, so site working properly' - echo 'Deploy to production soon'
.restore_bitrix:
stage: build
variables:
GIT_STRATEGY: none
script:
- docker-compose exec -T bitrix bash -c 'cp /home/bitrix/backup/bitrix.tar.gz .'
- docker-compose exec -T bitrix bash -c 'tar -xzvf bitrix.tar.gz'
- docker-compose exec -T bitrix bash -c 'rm -f bitrix.tar.gz'
when: manual
.backup_bitrix:
stage: build
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
script: environment:
- tar -czf bitrix.tar.gz bitrix/ upload/ name: production
- mv bitrix.tar.gz /tmp/ url: $PRODUCTION_URL
artifacts: only:
paths: - tags
- www/bitrix/
- www/upload/
expire_in: 1 day
when: manual
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