Skip to content

Instantly share code, notes, and snippets.

@nimi0112
Created October 7, 2021 15:01
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 nimi0112/65c05184c9ddaf6faeff4f82f697a0dc to your computer and use it in GitHub Desktop.
Save nimi0112/65c05184c9ddaf6faeff4f82f697a0dc to your computer and use it in GitHub Desktop.
Bitrise Yaml file with Slack Integration
---
format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
deploy:
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@6: {}
- cache-pull@2: {}
- install-missing-android-tools@3:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- change-android-versioncode-and-versionname@1:
inputs:
- build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle"
- android-lint@0:
inputs:
- project_location: "$PROJECT_LOCATION"
- variant: "$VARIANT"
- android-unit-test@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- variant: "$VARIANT"
- android-build@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$VARIANT"
- sign-apk@1:
run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
- deploy-to-bitrise-io@2: {}
- script@1:
inputs:
- content: |-
#!/bin/bash
set -e
set -x
if [ $BITRISE_BUILD_STATUS -eq 1 ]
then envman add --key GIPHY_KEYWORDS --value "call 911,fail,disappointed,try again,alarm"
else envman add --key GIPHY_KEYWORDS --value "build,success,congrats,victory,such wow,awesome,shipit,yes,panda,cat,hell yeah,applaud,lgtm,surprise,suprise motherfucker,high five,legendary,lil bub"
fi
- giphy@0:
inputs:
- gif_words: "$GIPHY_KEYWORDS"
- slack@3:
inputs:
- api_token: ''
- channel: "#books"
- webhook_url: "$SLACK_WEBHOOK"
- author_name: 'Build #$BITRISE_BUILD_NUMBER '
- message: |-
:santa: Hola! New Build available
Commit message: ${GIT_CLONE_COMMIT_MESSAGE_SUBJECT}
- message_on_error: "\U0001F631 Bugger, Something went wrong"
- fields: |
Branch|${BITRISE_GIT_BRANCH}
Trigerred By |${GIT_CLONE_COMMIT_AUTHOR_NAME}
Trigerred At |${BITRISE_BUILD_TRIGGER_TIMESTAMP}
- buttons: |
Download Build|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
View All Artifacts|${BITRISE_BUILD_URL}
- is_debug_mode: 'yes'
- image_url: "$GIF_URL"
- cache-push@2: {}
primary:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6: {}
- cache-pull@2: {}
- script@1:
title: Do anything with Script step
- install-missing-android-tools@3:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- android-lint@0:
inputs:
- project_location: "$PROJECT_LOCATION"
- variant: "$VARIANT"
- android-unit-test@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- variant: "$VARIANT"
- deploy-to-bitrise-io@2: {}
- cache-push@2: {}
app:
envs:
- opts:
is_expand: false
PROJECT_LOCATION: "."
- opts:
is_expand: false
MODULE: app
- opts:
is_expand: false
VARIANT: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment