Skip to content

Instantly share code, notes, and snippets.

@1gravity
Last active September 8, 2023 09:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 1gravity/d5a160094e5408fbff8f54c27b6c9e5c to your computer and use it in GitHub Desktop.
Save 1gravity/d5a160094e5408fbff8f54c27b6c9e5c to your computer and use it in GitHub Desktop.
Sample bitbucket pipeline for Android
image: androidsdk/android-30
pipelines:
branches:
master:
- step:
name: Create keystore and API key
script:
# create the keystore file and the google play api key file
- mkdir keys
- echo $KEYSTORE_FILE_BASE64 | base64 --decode > keys/$KEYSTORE_FILE
- echo $GOOGLE_PLAY_API_KEY_BASE64 | base64 --decode > keys/$GOOGLE_PLAY_API_KEY
artifacts:
- keys/**
- parallel:
- step:
name: Run unit tests
caches:
- gradle
script:
- export GRADLE_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
- "./gradlew -PKEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PKEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PKEY_ALIAS=$KEY_ALIAS
-PKEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
test"
artifacts:
- app/build/outputs/**
- app/build/reports/**
- step:
name: Build & deploy
caches:
- gradle
script:
# publish the aab file to the internal testing channel
- export GRADLE_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
- "./gradlew -PKEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PKEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PKEY_ALIAS=$KEY_ALIAS
-PKEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
clean :app:publishFreeReleaseBundle :app:publishProReleaseBundle"
artifacts:
- app/build/outputs/
- parallel:
- step:
name: Promote free version
caches:
- gradle
trigger: manual
script:
# promote the app from the internal testing channel to the production channel
- export GRADLE_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
- "./gradlew -PKEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PKEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PKEY_ALIAS=$KEY_ALIAS
-PKEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
promoteFreeReleaseArtifact --from-track internal --promote-track production --release-status completed"
- step:
name: Promote pro version
caches:
- gradle
trigger: manual
script:
# promote the app from the internal testing channel to the production channel
- export GRADLE_OPTS='-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
- "./gradlew -PKEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PKEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PKEY_ALIAS=$KEY_ALIAS
-PKEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
promoteProReleaseArtifact --from-track internal --promote-track production --release-status inProgress --user-fraction .5"
@ArcherEmiya05
Copy link

I get an error

Could not get unknown property 'APP_KEYSTORE_FILE' for SigningConfig_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null} of type com.android.build.gradle.internal.dsl.SigningConfig.

This is the SO question
https://stackoverflow.com/q/68218878/12204620

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment