Skip to content

Instantly share code, notes, and snippets.

@m8r1x
Created October 22, 2017 17:07
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save m8r1x/b1de49a989802e79aea7f28246c22e21 to your computer and use it in GitHub Desktop.
Save m8r1x/b1de49a989802e79aea7f28246c22e21 to your computer and use it in GitHub Desktop.
Sample gitlab CI file for deploying a `create-react-app` application to firebase.
image: node:6.11.3
cache:
key: cache_yarn
paths:
- .cache_yarn
stages:
- install
- build
- test
- deploy
install_functions:
stage: install
script:
- cd ./functions && yarn install --cache-folder ../.cache_yarn
only:
- staging
- production
artifacts:
paths:
- functions/node_modules
install_client:
stage: install
script:
- cd ./client && yarn install --cache-folder ../.cache_yarn
only:
- staging
- production
artifacts:
paths:
- client/node_modules
build_client:
stage: build
script:
- cd ./client && yarn build
only:
- staging
- production
dependencies:
- install_client
artifacts:
paths:
- client/build
test_client:
stage: test
script:
- cd ./client && yarn test
only:
- staging
- production
dependencies:
- install_client
deploy_all_staging:
stage: deploy
script:
- yarn global add firebase-tools --cache-folder ../.cache_yarn
- firebase --token $FIREBASE_DEPLOY_KEY_STAGING --project staging deploy
only:
- staging
environment:
name: staging
dependencies:
- install_functions
- build_client
deploy_all_production:
stage: deploy
script:
- yarn global add firebase-tools --cache-folder ../.cache_yarn
- firebase --token $FIREBASE_DEPLOY_KEY_PRODUCTION --project production deploy
only:
- production
environment:
name: production
dependencies:
- install_functions
- build_client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment