diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca4a8cf..5a5e138 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,11 +6,13 @@ on: - '*' env: - PROD_RELEASE_CI: true + PROD_RELEASE: true jobs: build_release_github: environment: production + env: + FLAVOR: github runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -23,13 +25,13 @@ jobs: - name: Generate keystore.properties run: | cat < keystore.properties - storeFile:${{ vars.KEYSTORE_STORE_FILE_PATH }} - storePassword:${{ secrets.KEYSTORE_STORE_PASSWORD }} - keyAlias:${{ secrets.KEYSTORE_KEY_ALIAS }} - keyPassword:${{ secrets.KEYSTORE_KEY_PASSWORD }} + storeFile:${{ vars.GH_KEYSTORE_STORE_FILE_PATH }} + storePassword:${{ secrets.GH_KEYSTORE_STORE_PASSWORD }} + keyAlias:${{ secrets.GH_KEYSTORE_KEY_ALIAS }} + keyPassword:${{ secrets.GH_KEYSTORE_KEY_PASSWORD }} EOF - name: Generate keystore.jks - run: echo "${{ secrets.KEYSTORE_JKS_BASE64 }}" | base64 --decode > keystore.jks + run: echo "${{ secrets.GH_KEYSTORE_JKS_BASE64 }}" | base64 --decode > keystore.jks - name: Generate google-services.json run: echo "${{ secrets.GOOGLE_SERVICES_BASE64 }}" | base64 --decode > app/google-services.json - name: Grant execute permission for gradlew @@ -46,13 +48,15 @@ jobs: - name: Publish APK on Github Release uses: softprops/action-gh-release@v2 with: - files: app/build/outputs/apk/release/app-release.apk + files: app/build/outputs/apk/$FLAVOR/release/app-$FLAVOR-release.apk generate_release_notes: true append_body: true body: ${{ env.RELEASE_NOTE }} build_release_google_play: environment: production + env: + FLAVOR: play runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -65,13 +69,13 @@ jobs: - name: Generate keystore.properties run: | cat < keystore.properties - storeFile:${{ vars.KEYSTORE_STORE_FILE_PATH }} - storePassword:${{ secrets.KEYSTORE_STORE_PASSWORD }} - keyAlias:${{ secrets.KEYSTORE_KEY_ALIAS }} - keyPassword:${{ secrets.KEYSTORE_KEY_PASSWORD }} + storeFile:${{ vars.PLAY_KEYSTORE_STORE_FILE_PATH }} + storePassword:${{ secrets.PLAY_KEYSTORE_STORE_PASSWORD }} + keyAlias:${{ secrets.PLAY_KEYSTORE_KEY_ALIAS }} + keyPassword:${{ secrets.PLAY_KEYSTORE_KEY_PASSWORD }} EOF - name: Generate keystore.jks - run: echo "${{ secrets.KEYSTORE_JKS_BASE64 }}" | base64 --decode > keystore.jks + run: echo "${{ secrets.PLAY_KEYSTORE_JKS_BASE64 }}" | base64 --decode > keystore.jks - name: Generate google-services.json run: echo "${{ secrets.GOOGLE_SERVICES_BASE64 }}" | base64 --decode > app/google-services.json - name: Grant execute permission for gradlew @@ -82,5 +86,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: subspace - path: app/build/outputs/bundle/release/app-release.aab + path: app/build/outputs/apk/$FLAVOR/release/app-$FLAVOR-release.aab diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 24e95b6..4b3288d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -33,12 +33,12 @@ android { } } - val isProdReleaseCI = System.getenv("PROD_RELEASE_CI")?.toBoolean() ?: false + val isProdRelease = System.getenv("PROD_RELEASE")?.toBoolean() ?: false signingConfigs { fun buildSignConfig(apkSigningConfig: ApkSigningConfig) { val keystorePropertiesFile = rootProject.file("keystore.properties") - if (isProdReleaseCI) { + if (isProdRelease) { val keystoreProperties = Properties() keystoreProperties.load(FileInputStream(keystorePropertiesFile)) keystoreProperties.let { @@ -89,7 +89,7 @@ android { onVariants { variant -> val googleTask = tasks.findByName("process${variant.name.replaceFirstChar(Char::uppercase)}GoogleServices") - googleTask?.enabled = isProdReleaseCI && "debug" != variant.buildType + googleTask?.enabled = isProdRelease && "debug" != variant.buildType } }