-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from erfansn/github-workflow
Create build_and_github_release.yml
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Build and Github Release | ||
run-name: Cooking the next version | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
build: | ||
name: Build APK | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Enable KVM group perms | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
ls /dev/kvm | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/[email protected] | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/[email protected] | ||
|
||
- name: Download Android NDK | ||
run: sdkmanager --install "ndk;25.2.9519653" | ||
|
||
- name: Download CMake | ||
run: sdkmanager --install "cmake;3.22.1" | ||
|
||
- name: Download OpenCV SDK | ||
uses: gamedev-thingy/Download-Extract@done | ||
with: | ||
url: https://github.com/opencv/opencv/releases/download/4.10.0/opencv-4.10.0-android-sdk.zip | ||
destination: .\opencv-sdk | ||
ZIPname: opencv-4.10.0-android-sdk.zip | ||
|
||
- name: Config OpenCV SDK | ||
run: echo "$GITHUB_WORKSPACE\opencv-sdk" > "opencv.properties" | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Decode and persist temporarily Keystore | ||
run: | | ||
DEST_FILE_PATH="${RUNNER_TEMP}"/release-key.jks | ||
echo "KEYSTORE_FILE_PATH=$DEST_FILE_PATH" >> "$GITHUB_ENV" | ||
base64 -d <<< "${{ secrets.RELEASE_STORE_FILE_BASE64 }}" > $DEST_FILE_PATH | ||
- name: Assemble release variant | ||
run: ./gradlew :app:assembleRelease | ||
env: | ||
RELEASE_STORE_FILE_PATH: ${{ env.KEYSTORE_FILE_PATH }} | ||
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | ||
RELEASE_KEY_PASS: ${{ secrets.RELEASE_KEY_PASS }} | ||
RELEASE_STORE_PASS: ${{ secrets.RELEASE_STORE_PASS }} | ||
|
||
- name: Upload APK | ||
uses: actions/[email protected] | ||
with: | ||
name: app-release | ||
path: app/build/outputs/apk/release/app-release.apk | ||
|
||
release: | ||
name: Release | ||
needs: build | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download APK from build | ||
uses: actions/[email protected] | ||
with: | ||
name: app-release | ||
|
||
- name: Create release | ||
uses: softprops/[email protected] | ||
with: | ||
files: app-release.apk |