diff --git a/.github/workflows/build_sign_deploy_master_workflow.yml b/.github/workflows/build_sign_deploy_master_workflow.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml new file mode 100644 index 0000000..fb7d94a --- /dev/null +++ b/.github/workflows/release_workflow.yml @@ -0,0 +1,69 @@ +name: Build, Sign, Upload, and Release Workflow +on: + push: + branches: # Change this to master once everything is setup. + - 'develop' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setting environment variables for date, ads, unity, and version + run: | + echo "DATE_TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + echo "IAP_NO_ADS=$(echo ${{ secrets.IAP_NO_ADS }})" >> $GITHUB_ENV + echo "PLACEMENT_BANNER_1=$(echo ${{ secrets.PLACEMENT_BANNER_1 }})" >> $GITHUB_ENV + echo "PLACEMENT_BANNER_1=$(echo ${{ secrets.PLACEMENT_BANNER_1 }})" >> $GITHUB_ENV + echo "PLACEMENT_BANNER_2=$(echo ${{ secrets.PLACEMENT_BANNER_2 }})" >> $GITHUB_ENV + echo "PLACEMENT_INTERSTITIAL=$(echo ${{ secrets.PLACEMENT_INTERSTITIAL }})" >> $GITHUB_ENV + echo "PLAY_CONSOLE_APP_RSA_KEY=$(echo ${{ secrets.PLAY_CONSOLE_APP_RSA_KEY }})" >> $GITHUB_ENV + echo "UNITY_APP_ID=$(echo ${{ secrets.UNITY_APP_ID }})" >> $GITHUB_ENV + echo "GIT_TAG=$(grep -E "versionName\s*=?\s*['\"]" "app/build.gradle.kts" | awk -F"['\"]" '{print $2}')" >> $GITHUB_ENV + - name: Configuring Java environment with Zulu JDK 17 and Gradle cache, + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: "17" + cache: gradle + - name: Granting executable permission to gradlewGenerating Unsigned Apk & Bundle + run: | + chmod +x ./gradlew + ./gradlew assembleRelease + ./gradlew bundleRelease + - name: Signing APK + uses: r0adkll/sign-android-release@v1 + id: signed_apk + with: + releaseDirectory: app/build/outputs/apk/release/ + signingKeyBase64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }} + alias: ${{ secrets.SIGNING_KEY_ALIAS }} + keyStorePassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + - name: Sign AAB + uses: r0adkll/sign-android-release@v1 + id: signed_aab + with: + releaseDirectory: app/build/outputs/bundle/release/ + signingKeyBase64: ${{ secrets.SIGNING_KEY_STORE_BASE64 }} + alias: ${{ secrets.SIGNING_KEY_ALIAS }} + keyStorePassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + # Uploading Signed AAB to internal track of PlayConsole + - name: Publish Signed AAB to Play Store Internal Track + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} + packageName: com.prime.toolz2 + releaseFiles: ${{steps.signed_aab.outputs.signedReleaseFile}} + track: internal + - name: Create Github Release using tag name v${{ env.GIT_TAG }} and uploading signed APK and AAB files + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ env.GIT_TAG }} + generate_release_notes: true + prerelease: false + files: | + ${{steps.signed_aab.outputs.signedReleaseFile}} + ${{steps.signed_apk.outputs.signedReleaseFile}} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1bd355b..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Test - -env: - # The name of the main module repository - main_project_module: app - - #on: - push: - branches: - # Change this to master once everything is setup. - - 'develop' - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # Set Current Date As Env Variable - - name: Setting Current Date as Env Variable - run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - # Constructing the GitTAG from versionName for creating a release. - - name: Constructing Git TAG - #run: echo "GIT_TAG=$(echo $(grep "versionName" "./app/build.gradle" | awk '{print $2}') | tr -d '"')" >> $GITHUB_ENV # get value versionName"0.1.0" - id: version - #run: GIT_TAG = $(echo $(grep "versionName" "./app/build.gradle" | awk '{print $2}') | tr -d '"') # get value versionName"0.1.0" - run: echo "::set-output name=GIT_TAG::$(tr -d '"' <<< $(grep "versionName" "./app/build.gradle" | awk '{print $2}'))" - env: - IAP_BUY_ME_COFFEE: ${{ secrets.IAP_BUY_ME_COFFEE }} - IAP_NO_ADS: ${{ secrets.IAP_NO_ADS }} - PLACEMENT_BANNER_1: ${{ secrets.PLACEMENT_BANNER_1 }} - PLACEMENT_BANNER_2: ${{ secrets.PLACEMENT_BANNER_2 }} - PLACEMENT_INTERSTITIAL: ${{ secrets.PLACEMENT_INTERSTITIAL }} - PLAY_CONSOLE_APP_RSA_KEY: ${{ secrets.PLAY_CONSOLE_APP_RSA_KEY }}UNITY_APP_ID - UNITY_APP_ID: ${{ secrets.UNITY_APP_ID }} - - name: Print environment variable - run: echo "The value of IAP_NO_ADS is $IAP_NO_ADS" diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5c64f7a..014d388 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,7 +17,7 @@ android { applicationId = "com.prime.toolz2" minSdk = 21 targetSdk = 34 - versionCode = 46 + versionCode = 48 versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true } @@ -131,27 +131,18 @@ dependencies { * Init adn add git secrets to BuildConfig */ fun ApplicationDefaultConfig.secrets() { - buildConfigField( - "String", - "IAP_BUY_ME_COFFEE", - System.getenv("IAP_BUY_ME_COFFEE") ?: "\"null\"" - ) - buildConfigField("String", "IAP_NO_ADS", System.getenv("IAP_NO_ADS") ?: "\"null\"") - buildConfigField( - "String", - "PLACEMENT_BANNER_1", - System.getenv("PLACEMENT_BANNER_1") ?: "\"null\"" - ) - buildConfigField( - "String", - "PLACEMENT_BANNER_2", - System.getenv("PLACEMENT_BANNER_2") ?: "\"null\"" - ) - buildConfigField( - "String", - "PLACEMENT_INTERSTITIAL", - System.getenv("PLACEMENT_INTERSTITIAL") ?: "\"null\"" - ) - buildConfigField("String", "UNITY_APP_ID", System.getenv("UNITY_APP_ID") ?: "\"null\"") - buildConfigField("String", "PLAY_CONSOLE_APP_RSA_KEY", System.getenv("PLAY_CONSOLE_APP_RSA_KEY") ?: "\"null\"") + var value = "\"" + (System.getenv("IAP_BUY_ME_COFFEE") ?: "empty") + "\"" + buildConfigField("String", "IAP_BUY_ME_COFFEE", value) + value = "\"" + (System.getenv("IAP_NO_ADS") ?: "empty") + "\"" + buildConfigField("String", "IAP_NO_ADS", value) + value = "\"" + (System.getenv("PLACEMENT_BANNER_1") ?: "empty") + "\"" + buildConfigField("String", "PLACEMENT_BANNER_1", value) + value = "\"" + (System.getenv("PLACEMENT_BANNER_2") ?: "empty") + "\"" + buildConfigField("String", "PLACEMENT_BANNER_2", value) + value = "\"" + (System.getenv("PLACEMENT_BANNER_2") ?: "empty") + "\"" + buildConfigField("String", "PLACEMENT_INTERSTITIAL", value) + value = "\"" + (System.getenv("UNITY_APP_ID") ?: "empty") + "\"" + buildConfigField("String", "UNITY_APP_ID", value) + value = "\"" + (System.getenv("PLAY_CONSOLE_APP_RSA_KEY") ?: "empty") + "\"" + buildConfigField("String", "PLAY_CONSOLE_APP_RSA_KEY", value) }