Skip to content

Instantly share code, notes, and snippets.

Created November 13, 2021 15:09
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
GitHub Action - Build Ionic Capacitor Android app
name: Build Android
on: [push, pull_request]
name: Build APK
runs-on: ubuntu-latest
- name: Checkout source
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
java-version: 1.8
- name: Setup Node.js
uses: actions/setup-node@v1
node-version: 13.x
- name: Install Ionic
run: npm install -g @ionic/cli
- name: Install app dependencies
run: npm install
- name: Build Ionic App
run: ionic build
- name: Copy Android
run: ionic capacitor copy android
- name: Build Android Dev APK
run: ionic capacitor build android
- name: Build Android Release APK
run: ionic capacitor build android --release --prod
- name: Generate the Android App Bundle
working-directory: ./android/
run: ./gradlew bundle
- name: Upload dev APK
uses: actions/upload-artifact@v1
name: app-dev
path: apk/app-debug.apk
- name: Upload release bundle
uses: actions/upload-artifact@v1
name: app-release
path: apk/app.aab
Copy link

Sohil876 commented Jan 23, 2022

Gives me error on uploading apks
"Path does not exist /home/runner/work/test-app/test-app/apk/app-debug.apk"
"Exit code 1 returned from process: file name '/home/runner/runners/2.286.1/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'."

Nvm, artifact is actually inside android folder, so prefixing upload folder location with ./android/ worked.

Copy link

Same error, I already tried with ./android/ prefix but still got the message, any idea?

Copy link

bh commented Nov 23, 2022

@darthleonard @Sohil876

This works for me:

      - name: Save release bundle as artifact
        uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3
          name: app-release
          path: |
            ${{ github.workspace }}/packages/app/android/app/build/outputs/bundle/release/*.aab
            ${{ github.workspace }}/packages/app/android/app/build/outputs/apk/release/*.apk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment