Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pboymt committed Mar 21, 2023
2 parents 65e8111 + 5a87bcb commit 291be66
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 35 deletions.
36 changes: 1 addition & 35 deletions .github/workflows/android.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Android CI
name: Development CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
tags:
- "v*"
workflow_dispatch:

env:
Expand Down Expand Up @@ -114,35 +112,3 @@ jobs:
name: mapping-${{ github.sha }}
path: app/build/outputs/mapping/release/mapping.txt
retention-days: 5

- name: Publish nightly build if on master
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
with:
files: |
app/build/outputs/apk/release/app-arm64-v8a-release.apk
app/build/outputs/apk/release/app-x86_64-release.apk
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
app/build/outputs/apk/release/app-x86-release.apk
draft: true
prerelease: true
tag_name: nightly-${{ github.sha }}
name: Nightly build for commit ${{ github.sha }}
body: Nightly build for commit ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish release if on tag
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: |
app/build/outputs/apk/release/app-arm64-v8a-release.apk
app/build/outputs/apk/release/app-x86_64-release.apk
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
app/build/outputs/apk/release/app-x86-release.apk
draft: false
prerelease: false
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
body: Release ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
125 changes: 125 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Development CI

on:
release:
types: [ published ]

env:
OPENCV_VERSION: 4.7.0
NDK_VERSION: 23.1.7779620
IS_ACTIONS: 1
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Setup tag info
run: |
GIT_TAG=${GITHUB_REF#refs/*/}
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_ENV
- uses: actions/checkout@v3

- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Cache OpenCV4Android SDK
id: cache-opencv
uses: actions/cache@v2
with:
path: ./opencv
key: ${{ runner.os }}-opencv-for-android-${{ env.OPENCV_VERSION }}
restore-keys: |
${{ runner.os }}-opencv-for-android-
- if: ${{ steps.cache-opencv.outputs.cache-hit != 'true' }}
name: Download OpenCV4Android and extract to :opencv
run: |
wget https://github.com/opencv/opencv/releases/download/$OPENCV_VERSION/opencv-$OPENCV_VERSION-android-sdk.zip -O opencv.zip
unzip opencv.zip OpenCV-android-sdk/sdk/* -d extracted-opencv
mv extracted-opencv/OpenCV-android-sdk/sdk opencv
rm -rf extracted-opencv opencv.zip
- name: Copy opencv.build.gradle.txt to opencv/build.gradle
run: cp opencv.build.gradle.txt opencv/build.gradle

- name: Cache NDK
id: cache-ndk
uses: actions/cache@v2
with:
path: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.NDK_VERSION }}
key: ${{ runner.os }}-ndk-${{ env.NDK_VERSION }}
restore-keys: |
${{ runner.os }}-ndk-
- if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
name: Install NDK
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;23.1.7779620" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
# - name: Extract keystore to $KEYSTORE_FILENAME before ensure the parent directory exists
# run: |
# mkdir -p $(dirname $KEYSTORE_FILENAME)
# echo $KEYSTORE_CONTENT | base64 --decode > $KEYSTORE_FILENAME

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: assembleRelease
#
# - name: Build with Gradle
# run: ./gradlew build
- name: List APKs
run: find ./ -name "*.apk"

- name: Update ARM64
uses: actions/upload-artifact@v3
with:
name: arm64-v8a-${{ github.sha }}
path: app/build/outputs/apk/release/app-arm64-v8a-release.apk

- name: Update x86_64
uses: actions/upload-artifact@v3
with:
name: x86_64-${{ github.sha }}
path: app/build/outputs/apk/release/app-x86_64-release.apk

- name: Update ARM32
uses: actions/upload-artifact@v3
with:
name: armeabi-v7a-${{ github.sha }}
path: app/build/outputs/apk/release/app-armeabi-v7a-release.apk

- name: Update x86
uses: actions/upload-artifact@v3
with:
name: x86-${{ github.sha }}
path: app/build/outputs/apk/release/app-x86-release.apk

- name: Update mapping
uses: actions/upload-artifact@v3
with:
name: mapping-${{ github.sha }}
path: app/build/outputs/mapping/release/mapping.txt
retention-days: 5

- name: Upload image to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'app/build/outputs/apk/release/*.apk'
file_glob: true
tag: ${{ env.GIT_TAG }}
overwrite: true

0 comments on commit 291be66

Please sign in to comment.