v1.0.0-20241225 #52
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
name: Android CI | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ "main", "dev" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create local.properties | |
run: touch local.properties | |
- name: Decode Keystore | |
env: | |
ENCODED_STRING: ${{ secrets.RELEASE_STORE_BASE64 }} | |
run: | | |
echo $ENCODED_STRING | base64 -di > release.keystore | |
- name: Assemble Release | |
run: | | |
./gradlew build assembleRelease \ | |
-DRELEASE_STORE_FILE=../release.keystore \ | |
-DRELEASE_STORE_PASSWORD='${{ secrets.RELEASE_STORE_PASSWORD }}' \ | |
-DRELEASE_KEY_ALIAS='${{ secrets.RELEASE_KEY_ALIAS }}' \ | |
-DRELEASE_KEY_PASSWORD='${{ secrets.RELEASE_KEY_PASSWORD }}' | |
- name: List Files | |
run: find . | |
- name: Upload release mobile APK | |
uses: actions/[email protected] | |
with: | |
name: mobile-release.apk | |
path: mobile/build/outputs/apk/release/mobile-release.apk | |
if-no-files-found: warn | |
- name: Upload release wear APK | |
uses: actions/[email protected] | |
with: | |
name: wear-release.apk | |
path: wear/build/outputs/apk/release/wear-release.apk | |
if-no-files-found: warn | |
- uses: burrunan/gradle-cache-action@v1 | |
name: Unit Test | |
with: | |
job-id: android | |
arguments: testDebugUnitTest | |
- name: Android Test Report | |
uses: asadmansr/[email protected] | |
if: ${{ always() }} # IMPORTANT: run Android Test Report regardless | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | |
- name: version | |
run: echo "::set-output name=version::$(grep 'controlx2_version =' build.gradle | cut -f2 -d= | tr -d '"' | tr -d '[:space:]')" | |
id: version | |
- name: release | |
uses: actions/create-release@v1 | |
id: create_release | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
with: | |
draft: false | |
prerelease: true | |
release_name: ${{ steps.version.outputs.version }} | |
tag_name: ${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Upload mobile asset | |
uses: actions/upload-release-asset@v1 | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./mobile/build/outputs/apk/release/mobile-release.apk | |
asset_name: mobile-release.apk | |
asset_content_type: application/vnd.android.package-archive | |
- name: Upload wear asset | |
uses: actions/upload-release-asset@v1 | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wear/build/outputs/apk/release/wear-release.apk | |
asset_name: wear-release.apk | |
asset_content_type: application/vnd.android.package-archive |