Skip to content

Instantly share code, notes, and snippets.

@ekpangmichael
Last active October 5, 2019 11:12
Show Gist options
  • Save ekpangmichael/b486fb98bd8131376c7d77db44387363 to your computer and use it in GitHub Desktop.
Save ekpangmichael/b486fb98bd8131376c7d77db44387363 to your computer and use it in GitHub Desktop.
# Set a base docker image, using node alpine because it is lightweight
image: node:10.16.0-alpine
# This folder is cached between builds and will speed up subsequent build
cache:
paths:
- node_modules/
# Function to deploy to Heroku
.deploy_script: &deploy_script
script:
- apk update && apk add git && apk add curl
- git remote add heroku https://heroku:[email protected]/$APP.git
- git push heroku HEAD:master -f
# Setup all the stages
stages:
- install
- test
- build
- deploy_production
# Linting job
Run install:
stage: install
script:
- yarn install
# Job to run test
Run test:
stage: test
script:
- yarn test
# Job to run build
Run build:
stage: build
script:
- yarn build
# Job to deploy master branch to production environment
Deploy to production:
stage: deploy_production
<<: *deploy_script
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment