-
-
Save aleksmiller/57d008b4a42d92bc651f394fff1c874b to your computer and use it in GitHub Desktop.
Build and Deploy a javascript app with Gitlab-Ci
This file contains 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: node:argon | |
before_script: | |
- apt-get -qq update | |
- apt-get -qq install -y python2.7 python2.7-dev build-essential make gcc g++ libicu-dev | |
- npm -g install npm --silent | |
- "echo -e \"export default {CLIENT_ID: '$CLIENT_ID'}\" > app/scripts/settings.js" | |
- npm set progress=false | |
- npm install --silent | |
stages: | |
- test | |
- build | |
- clean_up | |
run_tests: | |
stage: test | |
script: | |
- npm test | |
build_and_deploy_prod: | |
stage: build | |
script: | |
- npm run build | |
- mkdir dist/build | |
- tar czfC dist/build/latest.tar.gz dist/$CI_BUILD_REF_NAME/ . | |
- tar czfC dist/build/$CI_BUILD_REF.tar.gz dist/$CI_BUILD_REF_NAME/ . | |
- apt-get install -yqq ruby ruby-dev | |
- gem install dpl | |
- dpl --skip_cleanup --provider=s3 --region=eu-west-1 --access-key-id=$AWS_ACCESS_KEY --secret-access-key=$AWS_SECRET_KEY --bucket=$AWS_BUCKET --local-dir=dist/build/ --upload-dir=$CI_BUILD_REF_NAME | |
artifacts: | |
paths: | |
- dist/$CI_BUILD_REF_NAME/ | |
only: | |
- master | |
- develop | |
clean_up_job: | |
stage: clean_up | |
script: | |
- rm -rf node_modules | |
- rm -rf ~/.node-gyp | |
when: on_failure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment