I have a GitHub Actions script to build an Android app, but I need to include specific prebuilt libraries (ktmidi and rtmidi) that I prebuilt on my local machine before starting work on the project. How can I publish these libraries to ensure the Android app builds correctly?
My GitHub Actions code:
...
jobs:
build_android:
name: Assemble android release, send it into App Distribution and notify other team
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf libtool pkg-config libasound2-dev libjack-jackd2-dev cmake ninja-build doxygen
- name: Grant Permission for gradlew
run: chmod +x gradlew
- name: Initialize and Update Git Submodules
run: git submodule update --init --recursive
- name: Assemble Release
run: ./gradlew assembleRelease ...
Old version:
jobs:
build_android:
name: Assemble android release, send it into App Distribution and notify other team
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf libtool pkg-config libasound2-dev libjack-jackd2-dev cmake ninja-build doxygen
- name: Setup NDK Workaround
run: sudo mkdir -p /usr/local/lib/android/sdk/ndk && sudo chmod 777 /usr/local/lib/android/sdk/ndk
- name: Build and Publish ktmidi to Local Maven
run: |
ls -l ktmidi/
sed -i "s/signing {}/signing { sign(publishing.publications) }/" ktmidi/build.gradle.kts
sed -i "s/signing {}/signing { sign(publishing.publications) }/" ktmidi-jvm-desktop/build.gradle
sed -i "s/signing {}/signing { sign(publishing.publications) }/" ktmidi-native-ext/build.gradle.kts
./build-rtmidi.sh
./gradlew --warning-mode all build publishToMavenLocal
env:
GITHUB_TOKEN: ${{ secrets.MAVEN_PAT }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
I add download RtMidi 4.0.0 task to publish this library locally, but I get issue: 'rtmidi/rtmidi_c.h' file not found
.
I'm the ktmidi developer. Since you seem to have "downloaded" the repository content from GitHub, it would not contain those git submodules.
There are some dependencies under external
directory, and if your checkout directory there is empty, then you need to get the submodules too.
I would recommend to "clone" the git repository (git clone [the-ktmidi-repo-url]
), and run git submodule update --init --recursive
to make sure that they are checked out as well.