diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe645e3..210732f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,10 +50,27 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 + - name: Run unit tests + run: ./gradlew testDebugUnitTest + - name: Build APK run: | VERSION_CODE=$(git rev-list --count HEAD) - ./gradlew assembleSignedRelease -PVERSION_CODE=$VERSION_CODE + VERSION_BASE=$(git describe --tags --abbrev=0 | sed 's/^v//') + VERSION_DEV=$(git rev-list --count $(git describe --tags --abbrev=0)..HEAD) + if [ $VERSION_DEV -gt 0 ]; then + VERSION_NAME="${VERSION_BASE}.${VERSION_DEV}" + else + VERSION_NAME="${VERSION_BASE}" + fi + ./gradlew assembleSignedRelease -PVERSION_CODE=$VERSION_CODE -PVERSION_NAME=$VERSION_NAME + + - name: Upload APK + uses: actions/upload-artifact@v7 + with: + path: app/build/outputs/apk/signedRelease/app-signedRelease.apk + compression-level: 0 + archive: false - name: Release uses: softprops/action-gh-release@v3 diff --git a/app/build.gradle b/app/build.gradle index 7ccafe4..0f73aed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,7 @@ android { applicationId 'net.helcel.beans' minSdk = 28 targetSdk = 37 - versionName "1.5" + versionName project.hasProperty('VERSION_NAME') ? project.property('VERSION_NAME') : "1.5" versionCode project.hasProperty('VERSION_CODE') ? project.property('VERSION_CODE').toInteger() : 1 } signingConfigs {