Search code examples
pythonandroidkivygithub-actionsbuildozer

How do I create an apk file from kivy with github


Is there a way to convert a kivy file to apk on github. I have been looking around online and there seems to be possible but I am not sure how to do it. If someone could help me I would be very thankfull because I cannot find a way to convert my kivy file to apk. I have tried bulldozer on a vm and rpi but keep getting errors


Solution

  • main.yml

    name: CI
    on:
      push:
        branches: [ main ]
      pull_request:
        branches: [ main ]
      schedule:
        - cron: '0 0 1,15 * *'
    
    jobs:
      build:
        runs-on: ubuntu-latest
    
        steps:
          - uses: actions/checkout@v2
    
          # used to cache dependencies with a timeout
          - name: Get Date
            id: get-date
            run: |
              echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
            shell: bash
    
          - name: Cache Buildozer global directory
            uses: actions/cache@v2
            with:
              path: .buildozer_global
              key: buildozer-global-${{ hashFiles('buildozer.spec') }} # Replace with your path
    
          - uses: actions/cache@v2
            with:
              path: .buildozer
              key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('buildozer.spec') }}
    
          - name: Build with Buildozer
            uses: ArtemSBulgakov/buildozer-action@v1
            id: buildozer
            with:
              command: buildozer android debug
              buildozer_version: master
    
          - name: Upload artifacts
            uses: actions/upload-artifact@v2
            with:
              name: package
              path: ${{ steps.buildozer.outputs.filename }}
    

    Step 1: make a repo in GitHub.

    Step 2: Add all your project files to the repo

    (Make sure your main.py and buildozer.spec are in the root dir i.e.: out side of any-folders)

    Step 3 : Go to Github action and there will be an option to setup yourself, when you click on it paste the code above and save changes.

    (When you edit the main.yml file and save ,it will start a build, in the .yml file you can see it has been given to build when there is a push into repo or merge into the repo.)

    Step 4: You have made the CI pipeline , now you will have to wait for it to build. You can see the logs in Realtime in the pipelines.

    For an working example refer to this repo: Github repo