ci: consolidate docker build into main workflow #40
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: Build android | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| test: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Run Tests | |
| run: ./gradlew test --stacktrace --warning-mode all | |
| apk: | |
| name: Generate APK | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build APK with Docker | |
| 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 omniedge-android-${{ github.ref_name }}.apk | |
| docker rm omniedge-build-container | |
| - name: Generate SHA256 checksums | |
| run: | | |
| sha256sum omniedge-android-${{ github.ref_name }}.apk >> OmniEdge-Android-${{ github.ref_name }}.SHA256.txt | |
| cat OmniEdge-Android-${{ github.ref_name }}.SHA256.txt | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: apk | |
| path: omniedge-android-${{ github.ref_name }}.apk | |
| - name: Upload SHA256 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SHA256 | |
| path: OmniEdge-Android-${{ github.ref_name }}.SHA256.txt | |
| release: | |
| name: Release APK | |
| needs: apk | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download APK from build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: apk | |
| - name: Download SHA256 from build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: SHA256 | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: OmniEdge-Android-${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| omniedge-android-${{ github.ref_name }}.apk | |
| OmniEdge-Android-${{ github.ref_name }}.SHA256.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Notify web-frontend to update docs | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.REPO_DISPATCH_TOKEN }} | |
| repository: omniedgeio/omniedge-web-frontend | |
| event-type: android-release | |
| client-payload: '{"package": "android", "version": "${{ github.ref_name }}"}' | |
| - name: Notify meta-repo to update submodule | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.REPO_DISPATCH_TOKEN }} | |
| repository: omniedgeio/omniedge | |
| event-type: meta-release | |
| client-payload: '{"package": "android", "version": "${{ github.ref_name }}"}' |