See the android-sdk Orb page for details on the jobs included by this Orb.
This basic setup will do the following:
- Checkout the Git repo and initialize any Git submodules.
- Run the
build
job.- Run Gradle's
check
andassemble
commands. - Upload coverage to (Code Cov)(https://codecov.io).
- Store artifacts:
reports
,test-results
,aar
, andapk
- Persists to workspace: the
build
folder forsdk-path
and theapk
folder for thesample-app-path
.
- Run Gradle's
- If this is a release (a Git tag that starts with
v
), then pause for user verification. - If verified by user, then run the
publish
job.- Run Gradle's
publish
command.
- Run Gradle's
version: 2.1
orbs:
android-sdk: rakutentech/android-sdk:{CURRENT_VERSION}
workflows:
version: 2.1
build-and-release:
jobs:
- android-sdk/build:
gradle-cache-key: gradle-{{ checksum "build.gradle" }}-{{ checksum "YOUR_SDK_PATH/build.gradle" }}
maven-cache-key: maven-{{ checksum "SDK_PATH/src/test/AndroidManifest.xml" }}
sdk-path: YOUR_SDK_PATH
sample-app-path: YOUR_SAMPLE_APP_PATH
# You can optionally define `pre-steps` which will run before any other steps in the job.
pre-steps:
- run:
command: echo "Pre steps"
# You can optionally define `after-prepare-steps` commands which will run after the project has been checked out and the Gradle dependencies have been downloaded
after-prepare-steps:
- run:
command: echo "After prepare"
# You can optionally define `post-steps` which will run after all other steps in the job have completed.
post-steps:
- run:
command: echo "Post steps"
filters:
tags:
only: /^v.*/
branches:
only: /.*/
- release-verification:
type: approval
requires:
- android-sdk/build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- android-sdk/publish:
requires:
- release-verification
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
You may want to build and publish an APK which uses your release keystore. In that case, you don't want to commit the keystore to your repository due to security reasons.
Instead, you can convert the keystore file to a base64 string, then add that string to CircleCI as an environment variable (in the project settings).
First, convert the keystore file to a base64 string:
openssl base64 -A -in release-keystore.jks
Copy the output of this and set it as an environment variable RELEASE_KEYSTORE_BASE64
in your CircleCI project settings.
Finally, when running your job you can convert this base64 string back into a file. If you are using the android-sdk
orb, then you can add this to the pre-steps section.
- run: |
if [[ $RELEASE_KEYSTORE_BASE64 != "" ]]; then
base64 -d \<<< $RELEASE_KEYSTORE_BASE64 > ./release-keystore.jks
fi
- Update docker image to
android:api-30
. This docker image uses Java 11, so your project must support building with Java 11
- Fix
after-prepare-steps
property for thepublish
job.
- Pin Android image to the latest version of api-29 which supported Java 8.
- Publish job: add
after-prepare-steps
parameter.
- Initial release.