Continuous Delivery for Android Using GitHub Actions | Kodeco

Learn how to create a continuous delivery pipeline in Android to deploy your apps to the Google Play Store.


This is a companion discussion topic for the original entry at https://www.kodeco.com/19407406-continuous-delivery-for-android-using-github-actions

Hi,

Thanks a lot for the course!

I’m getting an error in the unzip downloaded APK. My check_and_deploy.yml is:

  name: Android CI

on:
  push:
  #    tags:
  #      - 'v*'
  pull_request:
    branches:
      - main

jobs:
  test:
    name: unit-tests
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin' # See 'Supported distributions' for available options
          java-version: '17'
      - name: Unit tests
        run: ./gradlew test --stacktrace

  build:
    name: build
    #    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: set up JDK
        uses: actions/setup-java@v3
        with:
          distribution: 'temurin' # See 'Supported distributions' for available options
          java-version: '17'
      - name: Generate Release APK
        run: ./gradlew assembleRelease
      - name: Sign APK
        uses: ilharp/sign-android-release@v1
        # ID used to access action output
        id: sign_app
        with:
          releaseDir: app/build/outputs/
          signingKey: ${{ secrets.SIGNING_KEY }}
          keyAlias: ${{ secrets.KEY_ALIAS }}
          keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
          keyPassword: ${{ secrets.KEY_PASSWORD }}
          buildToolsVersion: 33.0.0
      - uses: actions/upload-artifact@v3
        with:
          name: release.apk
          path: /home/runner/work/myapp/myapp
      - uses: actions/upload-artifact@v3
        with:
          name: mapping.txt
          path: app/build/outputs/mapping/release/mapping.txt

  deploy-firebase:
    needs: [ build ]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v3
        id: download
        with:
          name: release.apk
      - name: 'Echo download path'
        run: echo ${{steps.download.outputs.download-path}}
      - name: unzip downloaded APK
        run: unzip ${{steps.download.outputs.download-path}}/release.apk
      - name: upload artifact to Firebase App Distribution
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          appId: ${{secrets.FIREBASE_APP_ID}}
          serviceCredentialsFileContent: ${{secrets.SERVICE_ACCOUNT}}
          groups: Testers
          file: app-release-unsigned-signed.apk

However, when it’s being run in Github Actions I’m getting:

In the actions-download@v3 artifact:

Artifact release.apk was downloaded to /home/runner/work/myapp/myapp
Artifact download has finished successfully

But then during the unzip downloaded APK:

Run unzip /home/runner/work/myapp/myapp/release.apk
  unzip /home/runner/work/myapp/myapp/release.apk
  shell: /usr/bin/bash -e ***0***
unzip:  cannot find or open /home/runner/work/myapp/myapp/release.apk, /home/runner/work/myapp/myapp/release.apk.zip or /home/runner/work/myapp/myapp/release.apk.ZIP.
Error: Process completed with exit code 9.

Is there something I’m doing wrong here?

Thanks!

Hi @noloman , is there any reason you’re trying to unzip the download artifact?
actions/download-artifact@v3 should automatically unzip the file for you when downloading the artifact. So you’ll get app-release-unsigned-signed.apk immediately after download and you can proceed to firebase upload.

Did you try this already and face any issues?