stages: - build - cleanup_build - deploy - cleanup build_job: stage: build script: - yarn install - yarn run build - yarn run lint - yarn run test - yarn run e2e tags: - javascript except: - tags - master artifacts: paths: - dist expire_in: 30 min build_job_production: stage: build script: - yarn install - yarn run build-prod - yarn run lint - yarn run test - yarn run e2e tags: - javascript only: - master artifacts: paths: - dist expire_in: 30 min cleanup_build_job: stage: cleanup_build script: - rm -rf node_modules - rm -rf dist when: on_failure pages: stage: deploy environment: staging except: - tags - master script: - mv dist public artifacts: paths: - public dependencies: - build_job production: stage: deploy environment: production only: - master script: - if [[ -z "${WWW_DEPLOY_ROOT_PRODUCTION}" ]] ; then echo "WWW_DEPLOY_ROOT_PRODUCTION is not set" ; exit 1 ; fi - if [[ ! -d "${WWW_DEPLOY_ROOT_PRODUCTION}" ]] ; then mkdir -p "${WWW_DEPLOY_ROOT_PRODUCTION}" || die "Failed to create target directory for deployment!" ; fi - cp -r dist/* "${WWW_DEPLOY_ROOT_PRODUCTION}" cleanup_job: stage: cleanup script: - rm -rf node_modules when: always