Skip to content

Instantly share code, notes, and snippets.

@oliviayizhang
Created May 15, 2019 18:22
Show Gist options
  • Save oliviayizhang/b19f8cb1996b8653ef633d3b836a3ba7 to your computer and use it in GitHub Desktop.
Save oliviayizhang/b19f8cb1996b8653ef633d3b836a3ba7 to your computer and use it in GitHub Desktop.
Circle CI configuration for Expo project
version: 2
publish: &publish
working_directory: ~/loplop-native
docker:
- image: circleci/node:10.13.0
steps:
- checkout
- restore_cache:
name: Restore yarn package cache
key: v1-cache-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
- run:
name: Install dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save yarn package cache
paths:
- ~/.cache/yarn
key: v1-cache-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
- run:
name: Login into Expo
command: npx expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD
- run:
name: Save current branch name to an env variable
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo 'export EXPO_RELEASE_CHANNEL="default"' >> $BASH_ENV
else
echo 'export EXPO_RELEASE_CHANNEL=$CIRCLE_BRANCH' >> $BASH_ENV
fi
- run:
name: Publish to Expo
command: npx expo publish --non-interactive --max-workers 1 --release-channel $EXPO_RELEASE_CHANNEL
jobs:
build_and_test:
docker:
- image: circleci/node:10.13.0
steps:
- checkout
- restore_cache:
name: Restore yarn package cache
key: v1-cache-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
- run:
name: Install dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save yarn package cache
paths:
- ~/.cache/yarn
key: v1-cache-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "package.json" }}-{{ arch }}
- run:
name: Run tests
command: yarn test:js --ci
- run:
name: Run linting
command: yarn lint:js
publish_to_expo:
<<: *publish
workflows:
version: 2
workflow:
jobs:
- build_and_test
- publish_to_expo:
filters:
branches:
ignore: gh-pages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment