machine:
  xcode:
    version: 8.1
  environment:
    # Dummy values, Circle won't run without a project and scheme.
    XCODE_PROJECT: build/tangram.xcodeproj
    XCODE_SCHEME: phony
checkout:
  post:
    - git submodule sync
    - git submodule update --init
    - gem install jazzy
test:
  override:
    - if [ $CIRCLE_BRANCH = 'master' ]; then make ios; else make ios TANGRAM_IOS_FRAMEWORK_SLIM=1; fi
    - make ios-docs
  post:
    - if [ $CIRCLE_BRANCH = 'master' ]; then cd build/ios-framework-universal/Release &&
      zip -r ${CIRCLE_ARTIFACTS}/framework.zip TangramMap.framework; fi
    - if [ $CIRCLE_BRANCH = 'master' ]; then cd build/ &&
      zip -r ${CIRCLE_ARTIFACTS}/docs.zip ios-docs; fi

machine:
  xcode:
    version: 8.1
  environment:
    # Dummy values, Circle won't run without a project and scheme.
    XCODE_PROJECT: build/tangram.xcodeproj
    XCODE_SCHEME: phony
dependencies:
  pre:
    - brew install awscli
    - gem install jazzy
checkout:
  post:
    - git submodule update --init
test:
  override:
    - make ios TANGRAM_IOS_FRAMEWORK_SLIM=1
    - make ios-docs
deployment:
  snapshots:
    branch: master
    commands:
      # Build the framework in debug mode and package it into pod.zip
      - make ios DEBUG=1
      - cd build/ios-framework-universal/Debug/ && zip -r ${CIRCLE_ARTIFACTS}/pod.zip TangramMap.framework
      # Add the license file.
      - zip ${CIRCLE_ARTIFACTS}/pod.zip LICENSE
      # Upload the Cocoapods archive to S3.
      - aws s3 cp ${CIRCLE_ARTIFACTS}/pod.zip s3://ios.mapzen.com/tangram-snapshots/tangram-snapshot-${CIRCLE_BUILD_NUM}.zip
      - aws s3 cp ${CIRCLE_ARTIFACTS}/pod.zip s3://ios.mapzen.com/tangram-latest.zip
  releases:
    # For any tag of the form 1, 1.2, 1.2.3, etc. we will deploy a release build.
    tag: /[0-9]+(\.[0-9]+)*/
    owner: tangrams
    commands:
      # Build the framework in release mode and package it into pod.zip
      - make ios RELEASE=1
      - cd build/ios-framework-universal/Release/ && zip -r ${CIRCLE_ARTIFACTS}/pod.zip TangramMap.framework
      # Add the license file.
      - zip ${CIRCLE_ARTIFACTS}/pod.zip LICENSE
      # Upload the Cocoapods archive to S3.
      - aws s3 cp ${CIRCLE_ARTIFACTS}/pod.zip s3://ios.mapzen.com/tangram-releases/tangram-release-${CIRCLE_TAG}.zip

Enable CircleCI to deploy iOS builds to S3
Enable CircleCI to deploy iOS builds to S3
