Skip to content

Commit

Permalink
[#625] Add flavors
Browse files Browse the repository at this point in the history
  • Loading branch information
florentmaitre committed Sep 12, 2023
1 parent 3889fc5 commit 7eaf691
Show file tree
Hide file tree
Showing 36 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/actions/app-distribution/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ runs:
BRANCH_SHA=${{ github.event.pull_request.head.sha }}
COMMIT_SHA=${BRANCH_SHA:-$GITHUB_SHA}
[ ${{ inputs.append-git-sha-to-version-name }} == 'true' ] && VERSION_NAME_SUFFIX=-${COMMIT_SHA::7} || VERSION_NAME_SUFFIX=''
./gradlew app:appDistributionUpload -PapplicationId=com.orange.ods.test.app -PversionNameSuffix=$VERSION_NAME_SUFFIX -PversionCode=$GITHUB_RUN_NUMBER -PappDistributionVariants=release -PappDistributionGitTagPrefix=${{ inputs.git-tag-prefix }} -PappDistributionGroup=${{ inputs.group }} -PappDistributionGitTagSha=$COMMIT_SHA --stacktrace
./gradlew app:appDistributionUpload -PversionNameSuffix=$VERSION_NAME_SUFFIX -PversionCode=$GITHUB_RUN_NUMBER -PappDistributionVariants=qualifRelease -PappDistributionGitTagPrefix=${{ inputs.git-tag-prefix }} -PappDistributionGroup=${{ inputs.group }} -PappDistributionGitTagSha=$COMMIT_SHA --stacktrace
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
FIREBASE_TOKEN: ${{ inputs.firebase-token }}
6 changes: 3 additions & 3 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: app
path: app/build/outputs/apk/*/*.apk
path: app/build/outputs/apk/*/*/*.apk

- name: Store lib artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -168,12 +168,12 @@ jobs:
- name: Publish release to Google Play Store
run: |
./gradlew assembleRelease bundleRelease
curl -F 'file=@app/build/outputs/bundle/release/app-release.aab' https://oma-portal.orange.fr/oma/api/v1/external/applications/${{ secrets.OMA_APP_ID }}/artifacts -H "apiKey:${{ secrets.OMA_APP_TOKEN }}"
curl -F 'file=@app/build/outputs/bundle/prodRelease/app-prod-release.aab' https://oma-portal.orange.fr/oma/api/v1/external/applications/${{ secrets.OMA_APP_ID }}/artifacts -H "apiKey:${{ secrets.OMA_APP_TOKEN }}"
- name: Store Google Play Store artifacts
uses: actions/upload-artifact@v3
with:
name: google-play-store
path: |
app/build/outputs/apk/*/*.apk
app/build/outputs/apk/*/*/*.apk
app/build/outputs/bundle/*/*.aab
15 changes: 14 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ android {
compileSdk = Versions.compileSdk

defaultConfig {
applicationId = project.findTypedProperty<String>("applicationId") ?: "com.orange.ods.app"
minSdk = Versions.minSdk
targetSdk = Versions.targetSdk
val versionCodeProperty = project.findTypedProperty<String>("versionCode")
Expand Down Expand Up @@ -76,6 +75,20 @@ android {
}
}

val versionFlavorDimension = "version"
flavorDimensions.add(versionFlavorDimension)
productFlavors {
create("qualif") {
dimension = versionFlavorDimension
applicationId = "com.orange.ods.test.app"
}

create("prod") {
dimension = versionFlavorDimension
applicationId = "com.orange.ods.app"
}
}

firebaseAppDistribution {
releaseNotesFile = Firebase_gradle.AppDistribution.releaseNotesFilePath
groups = project.findTypedProperty("appDistributionGroup")
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions app/src/debug/res/values/ic_launcher_background.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/mipmap-anydpi-v26/ic_launcher.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/mipmap-anydpi-v26/ic_launcher_round.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class MavenCentralPublishPluginExtension {

companion object {
const val NAME = "mavenCentralPublish"
const val RELEASE_COMPONENT_NAME = "release"
const val VARIANT = "prodRelease"
}

var artifactId: String? = null
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
}

publishing {
singleVariant(MavenCentralPublishPluginExtension.RELEASE_COMPONENT_NAME) {
singleVariant(MavenCentralPublishPluginExtension.VARIANT) {
withSourcesJar()
withJavadocJar()
}
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/maven-central-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ apply {
afterEvaluate {
publishing {
publications {
create<MavenPublication>(MavenCentralPublishPluginExtension.RELEASE_COMPONENT_NAME) {
from(components[MavenCentralPublishPluginExtension.RELEASE_COMPONENT_NAME])
create<MavenPublication>(MavenCentralPublishPluginExtension.VARIANT) {
from(components["release"])
groupId = "com.orange.ods.android"
artifactId = pluginExtension?.artifactId ?: "ods-${project.name}"
this.version = version
Expand Down Expand Up @@ -86,6 +86,6 @@ afterEvaluate {
"GNUPG_SIGNING_PASSWORD"
)
useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword)
sign(publishing.publications[MavenCentralPublishPluginExtension.RELEASE_COMPONENT_NAME])
sign(publishing.publications[MavenCentralPublishPluginExtension.VARIANT])
}
}

0 comments on commit 7eaf691

Please sign in to comment.