ci: add docker-based android build workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Docker Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: Build APK with Docker | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and Run Docker Container | |
| run: | | |
| docker build -t omniedge-android-build . | |
| docker run --name omniedge-build-container omniedge-android-build | |
| docker cp omniedge-build-container:/project/app/build/outputs/apk/debug/app-debug.apk app-debug.apk | |
| docker rm omniedge-build-container | |
| - name: Extract Version | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep "versionName" app/build.gradle | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) | |
| if [ -z "$VERSION" ]; then | |
| VERSION="1.0.0" | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| mv app-debug.apk omniedge-android-${VERSION}.apk | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: omniedge-android-${{ env.VERSION }} | |
| path: omniedge-android-${{ env.VERSION }}.apk | |
| retention-days: 5 |