<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fredianto</title>
    <description>The latest articles on DEV Community by Fredianto (@nferdazel).</description>
    <link>https://dev.to/nferdazel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F427966%2Fe04f40cb-a9b4-47e0-9b5a-7e4c2b3a090e.jpg</url>
      <title>DEV Community: Fredianto</title>
      <link>https://dev.to/nferdazel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nferdazel"/>
    <language>en</language>
    <item>
      <title>Effortlessly Deploy Your Flutter App on Google Play Store</title>
      <dc:creator>Fredianto</dc:creator>
      <pubDate>Mon, 11 Sep 2023 03:26:19 +0000</pubDate>
      <link>https://dev.to/nferdazel/effortlessly-deploy-your-flutter-app-on-google-play-store-4p5a</link>
      <guid>https://dev.to/nferdazel/effortlessly-deploy-your-flutter-app-on-google-play-store-4p5a</guid>
      <description>&lt;p&gt;CI/CD, which stands for Continuous Integration/Continuous Delivery, involves automating the app release process. This streamlines the traditionally manual and error-prone steps, making it more efficient.&lt;/p&gt;

&lt;p&gt;Continuous Integration (CI) automatically handles tasks like building applications, testing, and merging code changes with the main codebase. Continuous Delivery (CD) manages the deployment of these code changes to the production environment. Continuous Deployment (CD) takes it a step further by automatically releasing applications to end-users.&lt;/p&gt;

&lt;p&gt;By incorporating CI/CD, we aim to enhance the efficiency of the application release process while maintaining its quality and integrity.&lt;/p&gt;

&lt;p&gt;In this study, I opted for GitHub Actions due to its widespread usage and extensive support. I will outline the steps involved in integrating GitHub Actions with Google Play services for Android.&lt;/p&gt;

&lt;p&gt;Though the initial setup may seem a bit complex, it will significantly streamline the application delivery process to our customers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Table of Contents&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;APK Signing&lt;/li&gt;
&lt;li&gt;Workflow Setup&lt;/li&gt;
&lt;li&gt;Versioning&lt;/li&gt;
&lt;li&gt;APK Building&lt;/li&gt;
&lt;li&gt;Preparing for Release&lt;/li&gt;
&lt;li&gt;Google Play Deployment&lt;/li&gt;
&lt;li&gt;Implementation Plan&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Signing the APK&lt;/strong&gt;&lt;br&gt;
Assuming you have a finalized app ready for release stored on GitHub, the initial step in the release process is to sign the APK. This involves creating a keystore for the upload process, which serves as proof of your app's authenticity.&lt;/p&gt;

&lt;p&gt;For Windows users, execute the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

keytool -genkey -v -keystore &amp;lt;path&amp;gt;\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the designated &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt;, you'll store the keystore file. Leaving this section blank will result in the keystore being stored in your project's root folder. When prompted, provide and remember the storePassword and keyPassword for subsequent steps. Running the above command will generate a new file named &lt;code&gt;upload-keystore.jks&lt;/code&gt; in your project's root directory. Move this file to the &lt;code&gt;android &amp;gt; app&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Next, within the android directory, generate a new file named &lt;code&gt;key.properties&lt;/code&gt;. Make sure to add this file to your &lt;code&gt;.gitignore&lt;/code&gt; to prevent it from being tracked by Git. Populate the file as follows:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

storePassword=#{STORE_PASSWORD}#
keyPassword=#{KEY_PASSWORD}#
keyAlias=upload
storeFile=./upload-keystore.jks


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Afterwards, navigate to your GitHub repository and access &lt;code&gt;Settings &amp;gt; Secrets and variables &amp;gt; Actions&lt;/code&gt;. Click on the "New repository secrets" button and create two secrets: one named &lt;strong&gt;STORE_PASSWORD&lt;/strong&gt; and the other &lt;strong&gt;KEY_PASSWORD&lt;/strong&gt;. Populate them with the passwords you established during the creation of &lt;code&gt;upload-keystore.jks&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfpsgndr720cu08x971m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfpsgndr720cu08x971m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6q0vnysso09ycxbfl5xy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6q0vnysso09ycxbfl5xy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable Gradle to utilize the keystore for the APK signing process, open the &lt;code&gt;android/app/build.gradle&lt;/code&gt; file and insert the following code above the android code block. This additional code instructs Gradle to read the &lt;code&gt;key.properties&lt;/code&gt; file that you generated earlier.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
...
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Certainly, please provide the specific code that you'd like to add before the buildTypes code block in the android/app/build.gradle file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

signingConfigs {
 release {
 keyAlias keystoreProperties['keyAlias']
 keyPassword keystoreProperties['keyPassword']
 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
 storePassword keystoreProperties['storePassword']
 }
}

buildTypes {
...
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Afterwards, update the contents of the &lt;code&gt;buildTypes&lt;/code&gt; code block with the following code. This modification ensures that our application is signed during a release build.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

buildTypes {
 release {
  signingConfig signingConfigs.release
 }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In order for version numbering to be done automatically, you also need to change the contents of the &lt;code&gt;pubspec.yaml&lt;/code&gt; file to be as follows.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

name: app_name
description: App description
publish_to: "none"
version: 99.99.99+99


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Please be aware that we've adjusted the version variable to &lt;code&gt;99.99.99+99&lt;/code&gt;. We've set this as a placeholder, allowing for convenient modification of the version number during the deployment process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Preparing the Workflow&lt;/strong&gt;&lt;br&gt;
Generate a YAML file with a name of your choice in the &lt;code&gt;.github/workflows/&lt;/code&gt; directory. Subsequently, populate the file as follows:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

name: Flutter Workflow
on:
  push:
    branches: [main]



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Versioning&lt;/strong&gt;&lt;br&gt;
The initial step in this workflow involves generating version numbers based on git tag numbers. To access repository information, it's necessary to include a GitHub token in the secrets. You can create a GitHub token by following this &lt;a href="https://github.com/settings/tokens" rel="noopener noreferrer"&gt;link&lt;/a&gt;. Please keep in mind that secret names cannot start with the term &lt;code&gt;GITHUB&lt;/code&gt;. For instance, you might save your GitHub token as &lt;code&gt;TOKEN_GITHUB&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once you've added the GitHub token to the secrets, we can proceed with the version number generation process. Append the following line below the existing one.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

jobs:
 version:
    name: Version Number
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Retrieve Tags and Branch History
        run: |
          git config remote.origin.url @github.com/${{github.repository"&amp;gt;https://x-access-token:${{secrets.TOKEN_GITHUB}}@github.com/${{github.repository}}
          git fetch --prune --depth=10000
      - name: Install GitVersion
        uses: gittools/actions/gitversion/setup@v0.9.7
        with:
          versionSpec: "5.x"
      - name: Use GitVersion
        id: gitversion
        uses: gittools/actions/gitversion/execute@v0.9.7
      - name: Creating version.txt with nuGetVersion
        run: echo ${{steps.gitversion.outputs.nuGetVersion}} &amp;gt; version.txt
      - name: Upload version.txt
        uses: actions/upload-artifact@v2
        with:
          name: gitversion
          path: version.txt


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The result of this stage will be a &lt;code&gt;version.txt&lt;/code&gt; file, which will hold the tag count that will serve as the version number for our application in subsequent steps.&lt;/p&gt;

&lt;p&gt;Moving forward, we'll configure the action to generate an APK for uploading to the Google Play Store. Prior to proceeding with the APK building stage, make sure to save &lt;code&gt;upload-keystore.jks&lt;/code&gt;, and if applicable, &lt;code&gt;.env&lt;/code&gt; and &lt;code&gt;key.properties&lt;/code&gt;, in the secrets repository.&lt;/p&gt;

&lt;p&gt;First, we'll encrypt the file using gpg and store its contents securely in the secrets repository. Additionally, we'll create secrets to securely store the passwords associated with each file used during encryption.&lt;/p&gt;

&lt;p&gt;You can encrypt the file with the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

gpg -c --armor file_name


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The command will generate a file with the extension .asc. Open this file, copy its contents, and then paste them into the secrets repository. Repeat this process for the other files as well. Below is a completed example for your reference.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjh3q7z5vr19y94ayzgua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjh3q7z5vr19y94ayzgua.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you've completed the encryption and storage process, include the following build block beneath the version block.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

build:
  name: Build APK and Creating Release
  needs: [version]
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v1
    - run: |
        echo "${{secrets.RELEASE_KEYSTORE}}" &amp;gt; upload-keystore.jks.asc
        echo "${{secrets.RELEASE_ENV}}" &amp;gt; .env.asc
        echo "${{secrets.RELEASE_PROP}}" &amp;gt; key.properties.asc
        gpg -d --passphrase "${{secrets.RELEASE_KEYSTORE_PASSWORD}}" --batch upload-keystore.jks.asc &amp;gt; android/app/upload-keystore.jks
        gpg -d --passphrase "${{secrets.RELEASE_ENV_PASSWORD}}" --batch .env.asc &amp;gt; .env
        gpg -d --passphrase "${{secrets.RELEASE_PROP_PASSWORD}}" --batch key.properties.asc &amp;gt; android/key.properties
    - name: Get version.txt
      uses: actions/download-artifact@v2
      with:
        name: gitversion
    - name: Create New File Without Newline Char from version.txt
      run: tr -d '\n' &amp;lt; version.txt &amp;gt; version1.txt
    - name: Read Version
      id: version
      uses: juliangruber/read-file-action@v1
      with:
        path: version1.txt
    - name: Update Version in YAML
      run: sed -i 's/99.99.99+99/${{steps.version.outputs.content}}+${{github.run_number}}/g' pubspec.yaml
    - name: Update Keystore Password in Gradle Properties
      run: sed -i 's/#{STORE_PASSWORD}#/${{secrets.STORE_PASSWORD}}/g' android/key.properties
    - name: Update Keystore Key Password in Gradle Properties
      run: sed -i 's/#{KEY_PASSWORD}#/${{secrets.KEY_PASSWORD}}/g' android/key.properties
    - uses: actions/setup-java@v1
      with:
        java-version: "12.x"
    - uses: subosito/flutter-action@v1
      with:
        channel: "stable"
    - run: flutter clean
    - run: flutter pub get
    - run: flutter build apk --release --split-per-abi --obfuscate --split-debug-info=symbols
    - run: flutter build appbundle --release --obfuscate --split-debug-info=symbols
    - name: Create a Release in GitHub
      uses: ncipollo/release-action@v1
      with:
        artifacts: "build/app/outputs/apk/release/*.apk,build/app/outputs/bundle/release/app-release.aab"
        token: ${{secrets.TOKEN_GITHUB}}
        tag: ${{steps.version.outputs.content}}
        commit: ${{github.sha}}
    - name: Upload App Bundle
      uses: actions/upload-artifact@v2
      with:
        name: appbundle
        path: build/app/outputs/bundle/release/app-release.aab


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As depicted, we echo the secrets to create a &lt;code&gt;.asc&lt;/code&gt; file with its corresponding name. We then decrypt the &lt;code&gt;.asc&lt;/code&gt; file, reverting it to its original state. This enables us to safely utilize the files without the need to include them in the Git repository.&lt;/p&gt;

&lt;p&gt;Within this &lt;code&gt;build&lt;/code&gt; block, we also substitute the version number placeholder with the one we generated in the previous step. Additionally, we replace the placeholders for &lt;code&gt;STORE_PASSWORD&lt;/code&gt; and &lt;code&gt;KEY_PASSWORD&lt;/code&gt; with the credentials stored in the secrets repository.&lt;/p&gt;

&lt;p&gt;Furthermore, we execute the &lt;code&gt;--obfuscate&lt;/code&gt; parameter to build both the APK and AAB with enhanced security measures. However, it's important to note that at this stage, we are unable to include the symbols file in the obfuscated APK or AAB, as we haven't taken any specific steps to preserve it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Release Preparation&lt;/strong&gt;&lt;br&gt;
Congratulations on reaching this milestone! In the previous stage, we successfully established version numbering and conducted an APK build with obfuscation. Furthermore, we securely stored the configuration files and keystore in the secrets repository. With these preparations completed, we're now ready to establish the connection between the Google Cloud Platform and Google Play Developer, ensuring a seamless release process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpk2don406arpsfdvccu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpk2don406arpsfdvccu6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To start the preparation, create a project and service account on &lt;a href="https://console.cloud.google.com/" rel="noopener noreferrer"&gt;Google Cloud&lt;/a&gt;. You can create a service account through the &lt;code&gt;IAM &amp;amp; Admin &amp;gt; Service Accounts&lt;/code&gt; menu. After the service account is created, click the option button on the right and open the Manage Keys menu. Create a new key and use JSON format. Copy the contents of the JSON file and save it in the secrets repository, for example with the name &lt;code&gt;PLAYSTORE_ACCOUNT_KEY&lt;/code&gt; as in the example below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8wyme6fifp70matbl41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8wyme6fifp70matbl41.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, establish a connection between the project in Google Cloud and the corresponding project in the Google Play Console. Ensure that you enable the following APIs in both the Google Cloud Platform and Google Play Console:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Google Play Android Developer API&lt;/li&gt;
&lt;li&gt;Google Play Developer Reporting API&lt;/li&gt;
&lt;li&gt;Google Play Games Services Publishing API.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxisvnotn6q5ahgzy6ke6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxisvnotn6q5ahgzy6ke6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For added security, navigate to the &lt;code&gt;User and Permissions&lt;/code&gt; menu in the Google Play Console. Then, choose the email associated with the service account you created. In the &lt;code&gt;App permissions&lt;/code&gt; section, select the specific app project you're working on. This step helps ensure proper access and permissions for the service account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furm4i1kxyufa2y32b63x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furm4i1kxyufa2y32b63x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, in this menu, you have the option to configure Account permissions. Below is an example of the permissions that I typically utilize.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3dn3iw0sgkogjz6c5mt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3dn3iw0sgkogjz6c5mt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Play Release&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notes: Before running this entire workflow, it's imperative that you manually upload the APK/AAB file to the Google Play Console.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this final stage of the workflow, you'll be uploading the AAB file to the Play Store through your chosen track. Currently, there are two tracks available: production and internal. To proceed, include the &lt;code&gt;release&lt;/code&gt; block below the existing blocks.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

release:
  name: Release app to production track
  needs: [build]
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v1
    - name: Get appbundle from artifacts
      uses: actions/download-artifact@v2
      with:
        name: appbundle
    - name: Release app to production track
      uses: r0adkll/upload-google-play@v1
      with:
        serviceAccountJsonPlainText: ${{secrets.PLAYSTORE_ACCOUNT_KEY}}
        packageName: com.app.package_name
        releaseFiles: app-release.aab
        track: production
        status: completed


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Those are the stages of Play Store CI/CD using GitHub Actions. The following is the content of the YAML script that we have written as a whole.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

name: Flutter Stream

on:
  push:
    branches: [main]

jobs:
  version:
    name: Create Version Number
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Feth Histories for All Tags and Branches
        run: |
          git config remote.origin.url @github.com/${{github.repository"&amp;gt;https://x-access-token:${{secrets.TOKEN_GITHUB}}@github.com/${{github.repository}}
          git fetch --prune --depth=10000
      - name: Install GitVersion
        uses: gittools/actions/gitversion/setup@v0.9.7
        with:
          versionSpec: "5.x"
      - name: Use GitVersion
        id: gitversion
        uses: gittools/actions/gitversion/execute@v0.9.7
      - name: Create version.txt with nuGetVersion
        run: echo ${{steps.gitversion.outputs.nuGetVersion}} &amp;gt; version.txt
      - name: Upload version.txt
        uses: actions/upload-artifact@v2
        with:
          name: gitversion
          path: version.txt
  build:
    name: Build APK and Create Release
    needs: [version]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - run: |
          echo "${{secrets.RELEASE_KEYSTORE}}" &amp;gt; upload-keystore.jks.asc
          echo "${{secrets.RELEASE_ENV}}" &amp;gt; .env.asc
          echo "${{secrets.RELEASE_PROP}}" &amp;gt; key.properties.asc
          gpg -d --passphrase "${{secrets.RELEASE_KEYSTORE_PASSWORD}}" --batch upload-keystore.jks.asc &amp;gt; android/app/upload-keystore.jks
          gpg -d --passphrase "${{secrets.RELEASE_ENV_PASSWORD}}" --batch .env.asc &amp;gt; .env
          gpg -d --passphrase "${{secrets.RELEASE_PROP_PASSWORD}}" --batch key.properties.asc &amp;gt; android/key.properties
      - name: Get version.txt
        uses: actions/download-artifact@v2
        with:
          name: gitversion
      - name: Create New File Without Newline Char from version.txt
        run: tr -d '\n' &amp;lt; version.txt &amp;gt; version1.txt
      - name: Read Version
        id: version
        uses: juliangruber/read-file-action@v1
        with:
          path: version1.txt
      - name: Update Version in YAML
        run: sed -i 's/99.99.99+99/${{steps.version.outputs.content}}+${{github.run_number}}/g' pubspec.yaml
      - name: Update Keystore Password in Gradle Properties
        run: sed -i 's/#{STORE_PASSWORD}#/${{secrets.STORE_PASSWORD}}/g' android/key.properties
      - name: Update Keystore Key Password in Gradle Properties
        run: sed -i 's/#{KEY_PASSWORD}#/${{secrets.KEY_PASSWORD}}/g' android/key.properties
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          channel: "stable"
      - run: flutter clean
      - run: flutter pub get
      - run: flutter build apk --release --split-per-abi --obfuscate --split-debug-info=symbols
      - run: flutter build appbundle --release --obfuscate --split-debug-info=symbols
      - name: Create a Release in GitHub
        uses: ncipollo/release-action@v1
        with:
          artifacts: "build/app/outputs/apk/release/*.apk,build/app/outputs/bundle/release/app-release.aab"
          token: ${{secrets.TOKEN_GITHUB}}
          tag: ${{steps.version.outputs.content}}
          commit: ${{github.sha}}
      - name: Upload App Bundle
        uses: actions/upload-artifact@v2
        with:
          name: appbundle
          path: build/app/outputs/bundle/release/app-release.aab
  release:
    name: Release App to Production Track
    needs: [build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Get Appbundle from Artifacts
        uses: actions/download-artifact@v2
        with:
          name: appbundle
      - name: Release App to Production Track
        uses: r0adkll/upload-google-play@v1
        with:
          serviceAccountJsonPlainText: ${{secrets.PLAYSTORE_ACCOUNT_KEY}}
          packageName: com.package.name
          releaseFiles: app-release.aab
          track: production
          status: completed


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
By implementing the CI/CD pipeline outlined above, companies can significantly reduce the manual effort required for app deployment. Additionally, the use of Google Play's internal track provides a structured approach to APK distribution, facilitating testing phases such as System Integration Testing (SIT) or User Acceptance Testing (UAT). This streamlined process ultimately leads to more efficient and reliable app releases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://resources.github.com/ci-cd/#:%7E:text=CI%2FCD" rel="noopener noreferrer"&gt;https://resources.github.com/ci-cd/#:~:text=CI%2FCD&lt;/a&gt; automates your builds,continuous delivery or continuous deployment.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.matijanovosel.com/blog/deploying-flutter-applications-to-google-play-using-github-actions" rel="noopener noreferrer"&gt;https://www.matijanovosel.com/blog/deploying-flutter-applications-to-google-play-using-github-actions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://stefma.medium.com/how-to-store-a-android-keystore-safely-on-github-actions-f0cef9413784" rel="noopener noreferrer"&gt;https://stefma.medium.com/how-to-store-a-android-keystore-safely-on-github-actions-f0cef9413784&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://iqan.medium.com/continuously-releasing-flutter-app-to-play-store-using-github-actions-eca2f5f6e996" rel="noopener noreferrer"&gt;https://iqan.medium.com/continuously-releasing-flutter-app-to-play-store-using-github-actions-eca2f5f6e996&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>flutter</category>
      <category>cicd</category>
      <category>github</category>
    </item>
  </channel>
</rss>
