Skip to content

Commit ad61ccf

Browse files
authored
Update android-build-scripts-16kb.yml
1 parent 917e73e commit ad61ccf

1 file changed

Lines changed: 78 additions & 58 deletions

File tree

.github/workflows/android-build-scripts-16kb.yml

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
name: android build scripts
22

33
on:
4-
workflow_dispatch:
4+
workflow_dispatch: # Allows manual triggering, which will create a release
5+
push:
56
branches:
67
- development
78
- main
9+
paths:
10+
- '.github/workflows/android-build-scripts.yml'
11+
- 'android/**'
12+
- '!android/README.md'
13+
- 'scripts/**'
14+
- 'tools/**'
15+
- 'android.sh'
816
pull_request:
917
branches:
1018
- development
@@ -43,13 +51,22 @@ jobs:
4351
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
4452
- name: run the build script
4553
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a
46-
- name: Upload Build Artifact
47-
uses: actions/upload-artifact@v4
54+
- name: prepare and upload main aar
55+
run: |
56+
AAR_PATH=$(find prebuilt -type f -name 'ffmpeg-kit.aar')
57+
if [ -z "$AAR_PATH" ]; then
58+
echo "Error: ffmpeg-kit.aar not found in prebuilt directory."
59+
exit 1
60+
fi
61+
mv "$AAR_PATH" "ffmpeg-kit-main-${{ matrix.ndk-version }}.aar"
62+
- uses: actions/upload-artifact@v4
4863
with:
49-
name: build-main-linux-${{ matrix.ndk-version }}
50-
path: |
51-
prebuilt/
52-
build.log
64+
name: ffmpeg-kit-main-aar-${{ matrix.ndk-version }}
65+
path: ffmpeg-kit-main-${{ matrix.ndk-version }}.aar
66+
if-no-files-found: error
67+
- name: print build logs
68+
if: ${{ always() }}
69+
run: cat build.log
5370
- name: print ffbuild logs
5471
if: ${{ failure() }}
5572
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
@@ -79,23 +96,32 @@ jobs:
7996
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
8097
- name: run the build script
8198
run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib
82-
- name: Upload Build Artifact
83-
uses: actions/upload-artifact@v4
99+
- name: prepare and upload lts aar
100+
run: |
101+
AAR_PATH=$(find prebuilt -type f -name 'ffmpeg-kit.aar')
102+
if [ -z "$AAR_PATH" ]; then
103+
echo "Error: ffmpeg-kit.aar not found in prebuilt directory."
104+
exit 1
105+
fi
106+
mv "$AAR_PATH" "ffmpeg-kit-lts-${{ matrix.ndk-version }}.aar"
107+
- uses: actions/upload-artifact@v4
84108
with:
85-
name: build-lts-linux-${{ matrix.ndk-version }}
86-
path: |
87-
prebuilt/
88-
build.log
109+
name: ffmpeg-kit-lts-aar-${{ matrix.ndk-version }}
110+
path: ffmpeg-kit-lts-${{ matrix.ndk-version }}.aar
111+
if-no-files-found: error
112+
- name: print build logs
113+
if: ${{ always() }}
114+
run: cat build.log
89115
- name: print ffbuild logs
90116
if: ${{ failure() }}
91117
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
92118

93-
build-main-without-ffmpeg-kit-protocols-on-linux:
94-
name: build without ffmpeg-kit protocols
95-
runs-on: ubuntu-22.04
119+
build-main-on-macos:
120+
name: android main on macos
121+
runs-on: macos-12
96122
strategy:
97123
matrix:
98-
ndk-version: [ 'r22b-linux-x86_64' ]
124+
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25b-darwin' ]
99125
defaults:
100126
run:
101127
shell: bash
@@ -106,33 +132,26 @@ jobs:
106132
with:
107133
distribution: 'adopt'
108134
java-version: '17'
109-
- name: prerequisites
110-
run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --uninstall "cmake;3.10.2.4988404" "cmake;3.18.1"
111135
- name: set up android ndk
112136
run: |
113137
curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip
114138
unzip -q -o ndk.zip -d .ndk
115139
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
116140
- name: run the build script
117-
run: ./android.sh --no-ffmpeg-kit-protocols --disable-x86 --disable-x86-64 --disable-arm-v7a --disable-arm-v7a-neon
118-
- name: Upload Build Artifact
119-
uses: actions/upload-artifact@v4
120-
with:
121-
name: build-no-protocols-linux-${{ matrix.ndk-version }}
122-
path: |
123-
prebuilt/
124-
build.log
141+
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a
142+
- name: print build logs
143+
if: ${{ always() }}
144+
run: cat build.log
125145
- name: print ffbuild logs
126146
if: ${{ failure() }}
127147
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
128148

129-
# macOS jobs remain unchanged
130-
build-main-on-macos:
131-
name: android main on macos
149+
build-lts-on-macos:
150+
name: android lts on macos
132151
runs-on: macos-12
133152
strategy:
134153
matrix:
135-
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25b-darwin' ]
154+
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin' ]
136155
defaults:
137156
run:
138157
shell: bash
@@ -149,20 +168,20 @@ jobs:
149168
unzip -q -o ndk.zip -d .ndk
150169
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
151170
- name: run the build script
152-
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a
171+
run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib
153172
- name: print build logs
154173
if: ${{ always() }}
155174
run: cat build.log
156175
- name: print ffbuild logs
157176
if: ${{ failure() }}
158177
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
159178

160-
build-lts-on-macos:
161-
name: android lts on macos
162-
runs-on: macos-12
179+
build-main-without-ffmpeg-kit-protocols-on-linux:
180+
name: build without ffmpeg-kit protocols
181+
runs-on: ubuntu-22.04
163182
strategy:
164183
matrix:
165-
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin' ]
184+
ndk-version: [ 'r22b-linux-x86_64' ]
166185
defaults:
167186
run:
168187
shell: bash
@@ -173,46 +192,47 @@ jobs:
173192
with:
174193
distribution: 'adopt'
175194
java-version: '17'
195+
- name: prerequisites
196+
run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --uninstall "cmake;3.10.2.4988404" "cmake;3.18.1"
176197
- name: set up android ndk
177198
run: |
178199
curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip
179200
unzip -q -o ndk.zip -d .ndk
180201
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
181202
- name: run the build script
182-
run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib
203+
run: ./android.sh --no-ffmpeg-kit-protocols --disable-x86 --disable-x86-64 --disable-arm-v7a --disable-arm-v7a-neon
183204
- name: print build logs
184205
if: ${{ always() }}
185206
run: cat build.log
186207
- name: print ffbuild logs
187208
if: ${{ failure() }}
188209
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
189210

190-
# NEW JOB TO CREATE THE RELEASE
191211
create-release:
192-
name: Create GitHub Release
212+
name: create github release
213+
# This job depends on the successful completion of both Linux build jobs
214+
needs: [build-main-on-linux, build-lts-on-linux]
193215
runs-on: ubuntu-latest
194-
# This job depends on all Linux build jobs finishing successfully
195-
needs:
196-
- build-main-on-linux
197-
- build-lts-on-linux
198-
- build-main-without-ffmpeg-kit-protocols-on-linux
199-
# Only run for manual triggers on the main branch
200-
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
216+
# Condition: Only run this job when the workflow is manually triggered
217+
if: github.event_name == 'workflow_dispatch'
201218
permissions:
202-
contents: write # This permission is required to create a release
219+
contents: write # Required to create a release
203220
steps:
204-
- name: Download all build artifacts
221+
- name: set release tag
222+
id: set_tag
223+
run: echo "TAG_NAME=ffmpeg-kit-android-$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV
224+
- name: download all aar artifacts
205225
uses: actions/download-artifact@v4
206226
with:
207-
path: artifacts/
208-
209-
- name: Package artifacts into a single archive
210-
run: tar -czvf linux-builds-${{ github.run_number }}.tar.gz -C artifacts .
211-
212-
- name: Create Release and Upload Artifact
227+
path: aar-artifacts
228+
- name: list downloaded files for debug
229+
run: ls -R aar-artifacts
230+
- name: create github release and upload assets
213231
uses: softprops/action-gh-release@v2
214232
with:
215-
name: "Android Linux Builds ${{ github.run_number }}"
216-
tag_name: "v${{ github.run_number }}"
217-
body: "Automated release containing all Linux build artifacts."
218-
files: "linux-builds-${{ github.run_number }}.tar.gz"
233+
tag_name: ${{ env.TAG_NAME }}
234+
name: "Android AARs ${{ env.TAG_NAME }}"
235+
body: "Automated release of Android AAR files from Linux builds."
236+
prerelease: true
237+
# Use a glob pattern to upload all downloaded .aar files
238+
files: aar-artifacts/*/*.aar

0 commit comments

Comments
 (0)