Skip to content

Instantly share code, notes, and snippets.

@stewartbryson
Created February 14, 2019 16:39
Show Gist options
  • Save stewartbryson/87393f73348abf9b1d3c111d9be8eaf3 to your computer and use it in GitHub Desktop.
Save stewartbryson/87393f73348abf9b1d3c111d9be8eaf3 to your computer and use it in GitHub Desktop.
Workflow with conditions
version: 2
jobs:
checkout:
machine: true
working_directory: ~/workspace
steps:
- checkout
release:
machine: true
working_directory: ~/workspace
steps:
- restore_cache:
keys:
- gradle-{{ checksum "build.gradle" }}-{{ checksum "settings.gradle" }}
- run:
command: ./gradlew release -Prelease.disableChecks -Prelease.localOnly
build:
machine: true
working_directory: ~/workspace
steps:
- run:
name: Build and Test
command: ./gradlew build
- store_artifacts:
path: build/distributions
destination: distributions
- store_artifacts:
path: build/libs
destination: libs
test:
machine: true
working_directory: ~/workspace
steps:
- run:
name: Build and Test
command: ./gradlew build runAllTests
- save_cache:
paths:
- ~/.gradle
- ~/.m2
key: gradle-{{ checksum "build.gradle" }}-{{ checksum "settings.gradle" }}
- store_test_results:
path: build/test-results
publish:
machine: true
working_directory: ~/workspace
steps:
- run:
command: ./gradlew publishPlugins githubRelease
workflows:
version: 2
build-deploy:
jobs:
- checkout
- release:
filters:
branches:
only: master
requires:
- checkout
- build:
requires:
- release
- test:
requires:
- build
- publish:
filters:
branches:
only: master
requires:
- test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment