CD #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
workflow_run: | |
workflows: [ "ci" ] | |
types: | |
- completed | |
jobs: | |
bundle: | |
name: Build Release AAB | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build Release AAB | |
run: ./gradlew bundleRelease | |
- name: Check for app bundle file | |
run: | | |
if [[ ! -f app/build/outputs/bundle/release/app-release.aab ]]; then | |
echo "Error: App bundle file not found!" | |
exit 1 # Terminate the job with an error | |
fi | |
- name: Sign App Bundle | |
if: success() | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.KEYSTORE_BASE64 }} | |
alias: ${{ secrets.KEYSTORE_ALIAS }} | |
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "30.0.2" | |
- name: Upload Signed AAB | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-bundle | |
path: app/build/outputs/bundle/release/app-release.aab | |
deploy: | |
name: Deploy release AAB on Playstore | |
needs: [ bundle ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create service_account.json | |
run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json | |
- name: Deploy to Play Store | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJson: service_account.json | |
packageName: com.bulletapps.candypricer | |
releaseFiles: app/build/outputs/bundle/release/*.aab | |
track: production |