Skip to content

Update android.yml

Update android.yml #28

Workflow file for this run

name: Android CI
on:
push:
branches: [ "master" ]
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: Retrieve version name
run: echo VERSION_NAME=$(date "+%Y%m%d")_$(echo ${{ github.event.head_commit.id }} | head -c 7) >> $GITHUB_ENV
- name: Retrieve version code
run: echo VERSION_CODE=$(cat ${{ github.workspace }}/app/build.gradle | grep "versionCode" | grep -Eo "[0-9]+") >> $GITHUB_ENV
- name: Set version name
run: sed -i "s/versionName \".*\"/versionName \"${{ env.VERSION_NAME }}\"/" ${{ github.workspace }}/app/build.gradle
- name: Build with Gradle
run: ./gradlew assembleRelease
- name: Setup build tool version variable
shell: bash
run: |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: Sign APK
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ${{ github.workspace }}/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNINGKEYBASE64 }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEYSTOREPASSWORD }}
keyPassword: ${{ secrets.KEYPASSWORD }}
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: Renamae
run: mv ${{ github.workspace }}/app/build/outputs/apk/release/app-release-unsigned-signed.apk ${{ github.workspace }}/app/build/outputs/apk/release/fcmfix-ci-${{ env.VERSION_NAME }}.apk
- name: Upload built apk
uses: actions/upload-artifact@v3
with:
name: release
path: ${{ github.workspace }}/app/build/outputs/apk/release/fcmfix-ci-${{ env.VERSION_NAME }}.apk
- name: Release
uses: softprops/action-gh-release@v2
with:
name: "Auto Release ${{ env.VERSION_NAME }}"
tag_name: ${{ env.VERSION_CODE }}-${{ env.VERSION_NAME }}
token: "${{ secrets.TOKEN }}"
files: |
${{ github.workspace }}/app/build/outputs/apk/release/fcmfix-ci-${{ env.VERSION_NAME }}.apk
- name: Release lsposed module repository
if: ${{ github.event_name == 'push' && contains(github.event.head_commit.modified, 'app/build.gradle') }}
uses: softprops/action-gh-release@v2
with:
name: "Auto Release ${{ env.VERSION_NAME }}"
tag_name: ${{ env.VERSION_CODE }}-${{ env.VERSION_NAME }}
repository: Xposed-Modules-Repo/com.kooritea.fcmfix
token: "${{ secrets.TOKEN_CLASSIC }}"
files: |
${{ github.workspace }}/app/build/outputs/apk/release/fcmfix-ci-${{ env.VERSION_NAME }}.apk