-
Notifications
You must be signed in to change notification settings - Fork 7
/
bitrise.yml
183 lines (179 loc) · 5.53 KB
/
bitrise.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
format_version: 11
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "master"
workflow: build-and-test
- pull_request_source_branch: "*"
workflow: build-and-test
- tag: "v*.*.*"
workflow: release
workflows:
build-and-test:
before_run:
- _setup-env
after_run:
- _run-sonarqube-scanner
steps:
- cache-pull@2: {}
- script@1:
title: Dependency Check
inputs:
- timeout: 1800
- content: ./gradlew dependencyCheckAggregate
- deploy-to-bitrise-io:
is_always_run: true
title: Deploy Dependency Check Report
inputs:
- deploy_path: "$SDK_PATH/build/reports/dependency-check-report.html"
- script@1:
title: Run Check
inputs:
- content: ./gradlew check
- script@1:
title: Danger
inputs:
- content: |-
bundle install
bundle exec danger --dangerfile=config/danger/Dangerfile
- script@1:
title: Retrieve sample app Base64 key and save to file
inputs:
- content: |-
if [[ "$SAMPLE_APP_RELEASE_KEY_BASE64" != "" ]]; then
base64 -d <<< "$SAMPLE_APP_RELEASE_KEY_BASE64" > ./sdk-utils-sample-releasekey.keystore
fi
- script@1:
title: Assemble
inputs:
- content: ./gradlew assemble
- script@1:
title: Current Version
inputs:
- content: ./gradlew currentVersion
- custom-test-results-export@0:
inputs:
- test_name: "${SDK_PATH}_debug"
- base_path: "$SDK_PATH/build/test-results/testDebugUnitTest/"
- search_pattern: "*"
- custom-test-results-export@0:
inputs:
- test_name: "${SDK_PATH}_release"
- base_path: "$SDK_PATH/build/test-results/testReleaseUnitTest/"
- search_pattern: "*"
- deploy-to-bitrise-io@2:
is_always_run: false
inputs:
- is_enable_public_page: 'false'
- deploy_path: sample/build/outputs/apk/debug/sdk-utils-sample-debug.apk
- deploy-to-bitrise-io@2:
is_always_run: false
inputs:
- is_enable_public_page: 'false'
- deploy_path: sample/build/outputs/apk/release/sdk-utils-sample-release.apk
- cache-push@2:
inputs:
- cache_paths: |-
$HOME/.gradle
./.gradle
$HOME/.m2
- ignore_check_on_paths: |-
$HOME/.gradle/caches/*.lock
./.gradle/*.lock
./.gradle/*.bin
release:
before_run:
- build-and-test
after_run:
- _create-github-release
steps:
- script@1:
title: Retrieve Base64 PGP Key and save to file
inputs:
- content: |-
if [[ "$RELEASE_PGP_KEY_BASE64" != "" ]]; then
base64 -d <<< "$RELEASE_PGP_KEY_BASE64" > ./maven-central-key.gpg
fi
- script@1:
title: Publish Artifacts
inputs:
- content: ./gradlew publish
_setup-env:
steps:
- set-java-version@1:
inputs:
- set_java_version: '11'
- git-clone@6:
inputs:
- fetch_tags: 'yes'
- merge_pr: 'no'
- update_submodules: 'yes'
_run-sonarqube-scanner:
steps:
- set-java-version@1:
inputs:
- set_java_version: '11'
- script@1:
title: Prepare branches to feed in sonar.gradle
inputs:
- content: |-
#!/bin/bash
set -e
# Destination branch
git fetch --no-tags origin master
# Source branch
# For release
echo $BITRISE_TRIGGERED_WORKFLOW_ID
if [[ $BITRISE_TRIGGERED_WORKFLOW_ID == "release" ]]; then
echo "This is a release step, just making sure we are at master."
git fetch --no-tags origin master
git switch master
# For PRs
else
if [[ $BITRISEIO_PULL_REQUEST_REPOSITORY_URL != "" && \
$GIT_REPOSITORY_URL != $BITRISEIO_PULL_REQUEST_REPOSITORY_URL ]]; then
echo "This is a PR from a forked repo, will be creating temp branch with current hash:"
git log --pretty=format:'%h%n' -n 1
git switch -C $BITRISE_GIT_BRANCH
else
echo "This is a PR from the repo, just making sure we are at the right branch"
git fetch --no-tags origin $BITRISE_GIT_BRANCH
git switch $BITRISE_GIT_BRANCH
fi
fi
- script@1:
run_if: '{{getenv "SONARQUBE_TOKEN" | ne ""}}'
title: Run SonarQube Scanner
inputs:
- content: ./gradlew sonarqube
_create-github-release:
steps:
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
RELEASE_VER_RAW=$BITRISE_GIT_TAG
awk "
/## $RELEASE_VER_RAW/{flag=1;next}
/## v[0-9]/{flag=0}
flag
" $USERGUIDE_PATH > _releasenotes.md
RELEASE_NOTES=$(cat _releasenotes.md)
envman add --key RELEASE_NOTES --value "$RELEASE_NOTES"
- github-release@0.11:
inputs:
- body: "RELEASE_NOTES"
- draft: 'no'
- username: "GITHUB_BOT_USERNAME"
- api_token: "GITHUB_BOT_API_TOKEN"
- name: "$BITRISE_GIT_TAG"
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite
app:
envs:
- opts:
is_expand: false
SDK_PATH: sdk-utils