Bitrise - netguru/highway GitHub Wiki

#
# bitrise.yml
# Copyright © 2020 Netguru Sp. z o.o. All rights reserved.

format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

# Workflow trigger map.
#
# The following trigger map triggers a build only for pull requests against
# `develop` and `master` branches (from forks as well) and pushes to `develop`
# and `master` branches.
#
# More on trigger maps: http://devcenter.bitrise.io/webhooks/trigger-map

trigger_map:

  - push_branch: develop
    workflow: build-staging

  - push_branch: master
    workflow: build-pull-request

  - pull_request_target_branch: develop
    workflow: build-pull-request

  - pull_request_target_branch: master
    workflow: build-pull-request

  - push_branch: release/*
    workflow: build-release-candidate

  - pull_request_target_branch: release/*
    workflow: build-pull-request

app:
  envs:
    - BUILD_NUMBER: $BITRISE_BUILD_NUMBER
    - DEPLOY_DIR: $BITRISE_DEPLOY_DIR

# Workflow declarations.
#
# This list contains workflows used in the above trigger map.

workflows:

  # Build, test and deploy a staging app.
  #
  # This workflow pulls dependencies, builds and tests an app with staging
  # scheme and finally pushes the archived build to HockeyApp.

  build-staging:
    envs:
      - HIGHWAY_PRESET: staging
    before_run:
      - cache-pull
      - bundle-install
      - run-highway
    after_run:
      - cache-push
      - deploy-bitriseio

  # Build, test and deploy a release candidate app.
  #
  # This workflow pulls dependencies, builds and tests an app with production
  # scheme and finally pushes the archived build to HockeyApp.

  build-release-candidate:
    envs:
      - HIGHWAY_PRESET: release
    before_run:
      - cache-pull
      - bundle-install
      - run-highway
    after_run:
      - cache-push
      - deploy-bitriseio

  # Build and test a staging app.
  #
  # This workflow pulls dependencies and then builds and tests an app with
  # staging scheme.

  build-pull-request:
    envs:
      - HIGHWAY_PRESET: unit_tests
    before_run:
      - cache-pull
      - bundle-install
      - run-highway
    after_run:
      - cache-push
      - deploy-bitriseio

  # Pull previously cached directories.

  cache-pull:
    steps:
      - cache-pull: {}

  # Push cached directories.
  #
  # By default, this pushes both `./Carthage` and `./Pods` directories. If you
  # don't use those package managers in your app, you can remove a corresponding
  # line.

  cache-push:
    steps:
      - cache-push:
          inputs:
            - cache_paths: |-
                ./Carthage
                ./Pods

  # Install bundler
  bundle-install:
    steps:
      - script:
          title: 'bundle-install'
          inputs:
            - content: |-
               gem uninstall bundler --force
               gem install bundler --force
               bundle install

  # Run Highway
  run-highway:
    steps:
      - brew-install:
          title: Install gpg
          inputs:
            - packages: "gpg"
            - cache_enabled: "yes"
      - brew-install:
          title: Install 7zip
          inputs:
            - packages: "p7zip"
            - cache_enabled: "yes"
      - script:
          title: 'bundle exec fastlane highway'
          inputs:
            - content: bundle exec fastlane highway preset:$HIGHWAY_PRESET

  # Deploy build artifacts to bitrise.io.
  deploy-bitriseio:
    steps:
      - deploy-to-bitrise-io:
          inputs:
            - notify_user_groups: none
            - is_enable_public_page: false