Skip to content

Instantly share code, notes, and snippets.

@fabysdev
Created June 17, 2019 15:19
Show Gist options
  • Save fabysdev/679987d35d573bdd6a2fdd11a906f210 to your computer and use it in GitHub Desktop.
Save fabysdev/679987d35d573bdd6a2fdd11a906f210 to your computer and use it in GitHub Desktop.
.landing:
image: $BASE_IMAGE_PATH/js-develop:jsdev-1.0
only:
variables:
- $BUILD_LANDING == "true"
.landing_dir_script:
- &landing_dir |
cd projects && cd landing
# test
landing_test:
extends: .landing
stage: test
cache:
key: ${CI_COMMIT_SHA}
paths:
- projects/landing/node_modules/
script:
- *landing_dir
- npm ci
- npm run lint
- npm run test
# build
landing_build:
extends: .landing
stage: build
cache:
key: ${CI_COMMIT_SHA}
paths:
- projects/landing/node_modules/
policy: pull
artifacts:
paths:
- projects/landing/build/
when: on_success
expire_in: 30 minutes
script:
- *landing_dir
- npm run build
# push
landing_push:
stage: push
image: docker:git
services:
- docker:dind
dependencies:
- landing_build
only:
refs:
- master
- tags
variables:
- $BUILD_LANDING == "true"
script:
- *landing_dir
- export RELEASE_IMAGE=$BASE_IMAGE_PATH/landing:$CI_COMMIT_REF_NAME
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --no-cache -f ci/Dockerfile -t $RELEASE_IMAGE .
- docker push $RELEASE_IMAGE
# deploy [master]
landing_deploy_master:
extends: .landing
stage: deploy
when: manual
only:
refs:
- master
variables:
- $BUILD_LANDING == "true"
script:
- *landing_dir
- echo "landing deploy master"
- nodejs --version
# deploy [tags]
landing_deploy_tags:
extends: .landing
stage: deploy
when: manual
only:
refs:
- tags
variables:
- $BUILD_LANDING == "true"
script:
- *landing_dir
- echo "landing deploy tags"
- nodejs --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment