Merge branch 'feature/set-up-environments' into 'develop'
Feature/set up environments enable continuous delivery! See merge request !48
This commit is contained in:
commit
57aba62acf
2 changed files with 97 additions and 4 deletions
|
@ -1,8 +1,78 @@
|
||||||
Npm, Bower, Grunt:
|
variables:
|
||||||
|
NPMPATH: "node_modules/.bin"
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- cleanup_build
|
||||||
|
- deploy
|
||||||
|
- cleanup
|
||||||
|
|
||||||
|
.run_deploy: &run_deploy
|
||||||
|
script:
|
||||||
|
- chmod +x ./deploy.sh
|
||||||
|
- ./deploy.sh
|
||||||
|
|
||||||
|
build_job:
|
||||||
|
stage: build
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
- bower install
|
- $NPMPATH/bower install
|
||||||
- grunt
|
- $NPMPATH/grunt
|
||||||
tags:
|
tags:
|
||||||
|
- javascript
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- dist/*.min.*
|
||||||
|
- info/
|
||||||
|
- resources/
|
||||||
|
- index.html
|
||||||
|
- manifest.appcache
|
||||||
|
|
||||||
|
cleanup_build_job:
|
||||||
|
stage: cleanup_build
|
||||||
|
script:
|
||||||
|
- rm -rf node_modules
|
||||||
|
- rm -rf bower_components
|
||||||
|
- rm -rf dist
|
||||||
|
when: on_failure
|
||||||
|
|
||||||
|
develop:
|
||||||
|
stage: deploy
|
||||||
|
<<: *run_deploy
|
||||||
|
environment: develop
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
variables:
|
||||||
|
ENVIRON: develop
|
||||||
|
TARGET: $WWW_DEPLOY_ROOT_DEVELOP
|
||||||
|
|
||||||
|
staging:
|
||||||
|
stage: deploy
|
||||||
|
<<: *run_deploy
|
||||||
|
environment: staging
|
||||||
|
only:
|
||||||
|
- develop
|
||||||
|
variables:
|
||||||
|
ENVIRON: staging
|
||||||
|
TARGET: $WWW_DEPLOY_ROOT_STAGING
|
||||||
|
|
||||||
|
production:
|
||||||
|
stage: deploy
|
||||||
|
<<: *run_deploy
|
||||||
|
environment: production
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
variables:
|
||||||
|
ENVIRON: production
|
||||||
|
TARGET: $WWW_DEPLOY_ROOT_PRODUCTION
|
||||||
|
|
||||||
|
cleanup_job:
|
||||||
|
stage: cleanup
|
||||||
|
script:
|
||||||
|
- rm -rf node_modules
|
||||||
|
- rm -rf bower_components
|
||||||
|
when: always
|
||||||
|
|
23
deploy.sh
Normal file
23
deploy.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
declare destination
|
||||||
|
case "${TARGET}" in
|
||||||
|
"${WWW_DEPLOY_ROOT_DEVELOP}")
|
||||||
|
destination="${TARGET}/${CI_BUILD_REF_NAME}"
|
||||||
|
;;
|
||||||
|
"${WWW_DEPLOY_ROOT_STAGING}"|"${WWW_DEPLOY_ROOT_PRODUCTION}")
|
||||||
|
destination="${TARGET}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid TARGET specified. Aborting deployment."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
rm -rf "${destination}/*"
|
||||||
|
rm -rf "${destination}/.??*"
|
||||||
|
mkdir -p "${destination}/dist"
|
||||||
|
cp -a index.html manifest.appcache info resources "${destination}"
|
||||||
|
cp -a dist/*.min.* "${destination}/dist"
|
||||||
|
|
||||||
|
echo "Deployment successful."
|
Loading…
Reference in a new issue