Last active
May 5, 2020 14:58
-
-
Save brunodasilvalenga/325a482188d874b5931200c135d869f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
image: dnxsolutions/musketeers:1.1.1-ecr | |
services: | |
- docker:18.03.1-ce-dind # needs to match gitlab runner version | |
variables: | |
DOCKER_HOST: tcp://docker:2375/ | |
DOCKER_DRIVER: overlay2 | |
BUILD_VERSION: $CI_COMMIT_SHORT_SHA | |
AWS_ROLE: ci-deploy | |
AWS_DEFAULT_REGION: ap-southeast-2 | |
cache: | |
key: ${CI_COMMIT_REF_SLUG} | |
paths: | |
- node_modules/ | |
- package.json | |
- package-lock.json | |
stages: | |
- install | |
- build | |
- test | |
- deploy-developer | |
- deploy-dev | |
- deploy-prod | |
# ------------------------------------------------------------------------------ | |
# CONTINUOUS INTEGRATION | |
# ------------------------------------------------------------------------------ | |
libraries: | |
tags: [example_runner, docker] | |
stage: install | |
script: | |
- make install | |
only: | |
- master | |
- merge_requests | |
cache: | |
policy: push | |
retry: 2 | |
artifacts: | |
paths: | |
- .cache/Cypress/ | |
- node_modules/ | |
- package.json | |
- package-lock.json | |
expire_in: 30 minutes | |
build: | |
tags: [example_runner, docker] | |
when: on_success | |
stage: build | |
script: | |
- make build | |
only: | |
- master | |
- merge_requests | |
cache: | |
policy: push | |
retry: 2 | |
artifacts: | |
paths: | |
- build/ | |
test: | |
tags: [example_runner, docker] | |
when: on_success | |
stage: test | |
script: | |
- make test | |
after_script: | |
- bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN} -s .cov | |
only: | |
- master | |
- merge_requests | |
cache: | |
policy: push | |
artifacts: | |
paths: | |
- build/ | |
# ------------------------------------------------------------------------------ | |
# CONTINUOUS DELIVERY | |
# ------------------------------------------------------------------------------ | |
# ------------- | |
# DEPLOY STAGE | |
# ------------- | |
'Deploy Developer': | |
tags: [example_runner, docker] | |
when: on_success | |
stage: deploy-developer | |
variables: | |
AWS_ENV: dev-${GITLAB_USER_ID} | |
AWS_ACCOUNT_ID: 000000000000 | |
S3_BUCKET_NAME: example-app-${GITLAB_USER_ID}-dev | |
APP_NAME: app-${GITLAB_USER_ID} | |
script: | |
- make deploy | |
only: | |
- merge_requests | |
cache: | |
policy: push | |
artifacts: | |
paths: | |
- build/ | |
environment: | |
name: app-react/developer-${GITLAB_USER_ID} | |
url: https://app-${GITLAB_USER_ID}.dev.cloud.example.com.au | |
'Deploy Dev': | |
tags: [example_runner, docker] | |
when: on_success | |
stage: deploy-dev | |
variables: | |
AWS_ENV: staging | |
AWS_ACCOUNT_ID: 000000000000 | |
S3_BUCKET_NAME: example-app-dev | |
APP_NAME: app | |
CYPRESS_BASE_URL: https://app.dev.cloud.example.com.au | |
script: | |
- make deploy integration-test | |
only: | |
- master | |
cache: | |
policy: push | |
artifacts: | |
paths: | |
- build/ | |
environment: | |
name: app-react/development-qa | |
url: https://app.dev.cloud.example.com.au | |
'Deploy Prod': | |
tags: [example_runner, docker] | |
when: manual | |
stage: deploy-prod | |
variables: | |
AWS_ENV: prod | |
AWS_ACCOUNT_ID: 000000000000 | |
S3_BUCKET_NAME: example-app-prod | |
APP_NAME: app | |
script: | |
- make deploy release | |
only: | |
- master | |
cache: | |
policy: push | |
artifacts: | |
paths: | |
- build/ | |
environment: | |
name: app-react/prod | |
url: https://app.prod.cloud.example.com.au |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment