Fix ci scripts and package to deploy to Heroku

parent d9a01db2
Pipeline #9245030 passed with stages
in 7 minutes and 48 seconds
......@@ -56,3 +56,5 @@ typings/
# dotenv environment variables file
.env
/webapp
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- release
variables:
CANDIDATE_IMAGE: registry.gitlab.com/wrpinheiro/gitlab-registry-example/node-demo:$CI_COMMIT_REF_NAME
IMAGE: registry.gitlab.com/wrpinheiro/gitlab-registry-example/node-demo:latest
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
create-image:
stage: build
script:
- docker build -t $CANDIDATE_IMAGE .
- docker push $CANDIDATE_IMAGE
test:
stage: test
script:
- docker run $CANDIDATE_IMAGE npm test
release:
stage: release
script:
- docker pull $CANDIDATE_IMAGE
- docker tag $CANDIDATE_IMAGE $IMAGE
- docker push $IMAGE
image: node:8.1.2
cache:
paths:
- node_modules/
before_script:
- apt update -qq
- apt install -qq -y apt-transport-https
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- apt update
- apt install yarn
- npm install --silent
webpack:
stage: build
script: "yarn build"
script:
- npm run build
mocha:
stage: test
script: "yarn test"
script:
- npm run test
heroku_deploy:
stage: deploy
script:
- apt install -qq -yruby
- apt update -qq
- apt install -qq -y ruby
- gem install -q dpl
- dpl --provider=heroku --app=$APP_NAME --api-key=$AUTH_TOKEN
only:
- master
......@@ -2,11 +2,15 @@
"name": "node-example",
"version": "1.0.0",
"description": "",
"engines": {
"node": "7.9.0"
},
"main": "server.js",
"scripts": {
"test": "mocha --timeout 10000",
"start": "node server.js",
"build": "webpack"
"build": "webpack -p",
"postinstall": "npm run build"
},
"author": "wellington.pinheiro@gmail.com",
"license": "ISC",
......@@ -18,13 +22,13 @@
"react": "^15.6.1",
"react-dom": "^15.6.1",
"webpack": "^3.0.0",
"webpack-dev-server": "^2.5.0"
},
"devDependencies": {
"webpack-dev-server": "^2.5.0",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react": "^6.24.1"
},
"devDependencies": {
"chai": "^4.0.2",
"chai-http": "^3.0.0",
"mocha": "^3.4.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment