Skip to content

Bump com.squareup.retrofit2:converter-gson from 2.11.0 to 3.0.0 #191

Bump com.squareup.retrofit2:converter-gson from 2.11.0 to 3.0.0

Bump com.squareup.retrofit2:converter-gson from 2.11.0 to 3.0.0 #191

Workflow file for this run

name: Android Build
permissions:
contents: write
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important: get all tags!
- name: Get Latest Tag
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "LATEST_TAG=${latest_tag}" >> $GITHUB_ENV
- name: Count Commits Since Latest Tag
run: |
# Get the number of commits since the latest tag
commits_since_tag=$(git rev-list ${LATEST_TAG}..HEAD --count)
echo "COMMITS_SINCE_TAG=${commits_since_tag}" >> $GITHUB_ENV
- name: Generate Version
run: |
# Extract version components
version_base="${LATEST_TAG#v}"
major=$(echo $version_base | cut -d. -f1)
minor=$(echo $version_base | cut -d. -f2)
patch=$(echo $version_base | cut -d. -f3)
# Increment patch by the number of commits since the last tag
new_patch=$((patch + $COMMITS_SINCE_TAG))
# Construct the new version string
new_version="$major.$minor.$new_patch"
# Calculate the version code (e.g., 1.0.5 -> 10005)
version_code=$((major * 10000 + minor * 100 + new_patch))
# Set environment variables
echo "NEW_VERSION_NAME=${new_version}" >> $GITHUB_ENV
echo "NEW_VERSION_CODE=${version_code}" >> $GITHUB_ENV
- name: Update build.gradle with new version code and version name
run: |
# Update versionCode and versionName in build.gradle
sed -i "s/versionCode [0-9]\+/versionCode ${NEW_VERSION_CODE}/" app/build.gradle
sed -i "s/versionName \"[^\"]*\"/versionName \"${NEW_VERSION_NAME}\"/" app/build.gradle
- name: Print Version
run: |
echo "Version Name: $NEW_VERSION_NAME"
echo "Version Code: $NEW_VERSION_CODE"
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew assembleRelease
tree app/build/outputs/apk/release
- uses: r0adkll/sign-android-release@v1.0.4
name: Sign app APK
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.KEYSTORE }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "35.0.0"
- name: Rename APK
run: |
ls -al app/build/outputs/apk/release
echo "Signed APK: ${{steps.sign_app.outputs.signedReleaseFile}}"
cp ${{steps.sign_app.outputs.signedReleaseFile}} KernelFlasher_${{ env.NEW_VERSION_CODE }}.apk
- name: Upload APK
uses: actions/upload-artifact@v4.3.5
with:
name: KernelFlasher_${{ env.NEW_VERSION_CODE }}
path: KernelFlasher_${{ env.NEW_VERSION_CODE }}.apk
# - name: Rename apk
# run: |
# ls -al
# DATE=$(date +'%y.%m.%d')
# echo "TAG=$DATE" >> $GITHUB_ENV
# - name: Upload release
# uses: ncipollo/release-action@v1.14.0
# with:
# allowUpdates: true
# removeArtifacts: true
# name: "1.${{ github.run_number }}.0"
# tag: "v1.${{ github.run_number }}.0"
# body: |
# Note: QMod KernelFlasher, support ksu-lkm
# artifacts: "*.apk"