Skip to content

Instantly share code, notes, and snippets.

@moatazeldebsy
Created May 6, 2021 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moatazeldebsy/253a936b7e937dfdc4736ca79b7fea19 to your computer and use it in GitHub Desktop.
Save moatazeldebsy/253a936b7e937dfdc4736ca79b7fea19 to your computer and use it in GitHub Desktop.
Bitrise Example YAML file for Article How to migrate your Android app from Jenkins to Bitrise
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: release
workflow: AndroidCICD
workflows:
AndroidCICD:
description: |
## How to get a signed APK
This workflow contains the **Sign APK** step. To sign your APK all you have to do is to:
1. Click on **Code Signing** tab
1. Find the **ANDROID KEYSTORE FILE** section
1. Click or drop your file on the upload file field
1. Fill the displayed 3 input fields:
1. **Keystore password**
1. **Keystore alias**
1. **Private key password**
1. Click on **[Save metadata]** button
That's it! From now on, **Sign APK** step will receive your uploaded files.
## To run this workflow
If you want to run this workflow manually:
1. Open the app's build list page
2. Click on **[Start/Schedule a Build]** button
3. Select **deploy** in **Workflow** dropdown input
4. Click **[Start Build]** button
Or if you need this workflow to be started by a GIT event:
1. Click on **Triggers** tab
2. Setup your desired event (push/tag/pull) and select **deploy** workflow
3. Click on **[Done]** and then **[Save]** buttons
The next change in your repository that matches any of your trigger map event will start **deploy** workflow.
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@5.1: {}
- cache-pull@2: {}
- file-downloader@1:
title: Download Google Service Account JSON
inputs:
- destination: "./keys/firebase-key.json"
- source: "$BITRISEIO_FirebaseKey_URL"
- script@1:
title: Save Google Service Account JSON
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "$SERVICE_ACCOUNT_KEY_JSON" > $HOME/.config/gcloud/application_default_credentials.json
gcloud auth activate-service-account --project=$GOOGLE_CLOUD_PROJECT --key-file=$SERVICE_ACCOUNT_KEY_JSON
- install-missing-android-tools@2:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- android-lint@0:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$VARIANT"
- android-unit-test@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: app
- variant: debug
- android-build@0:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: app
- variant: release
is_always_run: true
- sign-apk@1:
run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
- virtual-device-testing-for-android@1:
inputs:
- test_type: instrumentation
- test_devices: Pixel2,29,en,portrait
- deploy-to-bitrise-io@1: {}
- change-android-versioncode-and-versionname@1:
inputs:
- new_version_name: 1.2.3
- build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle"
- firebase-app-distribution@0:
inputs:
- release_notes: Bug fixes and improvements
- app: 1:1234567890:android:0a1b2c3d4e5f67890
- groups: qa-team
- testers: tester1@@example.com, tester2@example.com, tester3@example.com
- service_credentials_file: "./keys"
- firebase_token: "$BITRISEIO_FirebaseKey_URL"
- google-play-deploy@3:
inputs:
- package_name: app.demo.test
- track: production
- user_fraction: ''
- service_account_json_key_path: "$SERVICE_ACCOUNT_KEY_JSON"
- slack@3: {}
- cache-push@2: {}
app:
envs:
- opts:
is_expand: false
PROJECT_LOCATION: "."
- opts:
is_expand: false
MODULE: app
- opts:
is_expand: false
VARIANT: debug
meta:
bitrise.io:
machine_type_id: standard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment