Skip to content

Instantly share code, notes, and snippets.

@b0bbywan
Created February 4, 2016 11:33
Show Gist options
  • Save b0bbywan/31b43d5aed28e4c5a1d6 to your computer and use it in GitHub Desktop.
Save b0bbywan/31b43d5aed28e4c5a1d6 to your computer and use it in GitHub Desktop.
Build and Deploy a javascript app with Gitlab-Ci
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