Skip to content

Commit

Permalink
feat: Add internal and production track to release into PlayStore on CD
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentKobz committed Jul 18, 2024
1 parent 1708abc commit 0b6938c
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/playstore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: PlayStore release

on:
push:
branches:
- 129-playstore-cd-deployment
workflow_dispatch:
inputs:
deployment_type:
type: choice
description: "Deployment type"
options:
- internal
- production
default: internal
required: true

jobs:
playstore:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0.2"
bundler-cache: true

- name: Restore json key
run: echo "${{ secrets.GOOGLE_API_PUB_JSON_BASE64 }}" | base64 --decode > ${{ github.workspace }}/service-account.json

- name: Restore keystore
run: echo "${{ secrets.GOOGLE_KEYSTORE_BASE64 }}" | base64 --decode > ${{ github.workspace }}/demoscannerapp/debug.keystore

- name: Set up environment
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: Fastlane build and upload
run: bundle exec fastlane $DEPLOYMENT_TYPE
env:
DEPLOYMENT_TYPE: internal
KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_KEYSTORE_PASSWORD }}
SIGNKEY_PASSWORD: ${{ secrets.GOOGLE_SIGNKEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.GOOGLE_SIGNKEY_ALIAS }}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
21 changes: 18 additions & 3 deletions demoscannerapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,37 @@ android {
defaultConfig {
applicationId "com.enioka.scanner.demoscannerapp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
targetSdkVersion 33
versionCode 4
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}
signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("SIGNKEY_PASSWORD")
}
release {
storeFile file("debug.keystore")
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("SIGNKEY_PASSWORD")
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
applicationIdSuffix ".release"
}
debug {
signingConfig signingConfigs.debug
debuggable true
applicationIdSuffix ".debug"
}
Expand Down
4 changes: 4 additions & 0 deletions demoscannerapp/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class net.sourceforge.zbar.** {
*;
}
1 change: 1 addition & 0 deletions fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json_key_file("service-account.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
59 changes: 59 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do

lane :default do
internal
end

# LANE 1
desc "Publish a new version to the Google Play (INTERNAL)"
lane :internal do

# Generate AAB file
gradle(
task: "demoscannerapp:bundle",
build_type: "Release"
)

# Upload the AAB to play store (internal track)
upload_to_play_store(
package_name: "com.enioka.scanner.demoscannerapp.release",
track: 'internal',
release_status: "draft"
)
end

# LANE 2
desc "Publish a new version to the Google Play (PRODUCTION)"
lane :release do

# Generate AAB file
gradle(
task: "demoscannerapp:bundle",
build_type: "Release"
)

# Upload the AAB to play store (internal track)
upload_to_play_store(
package_name: "com.enioka.scanner.demoscannerapp.release",
track: 'production',
release_status: "draft"
)
end
end

0 comments on commit 0b6938c

Please sign in to comment.