Skip to content

Android Build to Artifact on Tag #309

Android Build to Artifact on Tag

Android Build to Artifact on Tag #309

name: Android Build to Artifact on Tag
on:
create:
jobs:
build-and-release:
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/androidBuild/')
runs-on: ubuntu-latest
steps:
- name: Decode Keystore
id: decode_keystore
uses: timheuer/[email protected]
with:
fileName: 'release.jks'
encodedString: ${{ secrets.KEYSTORE }}
- uses: actions/checkout@v4
- name: Set timezone
run: echo "TZ=Europe/London" >> $GITHUB_ENV
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Gradle build
run: ./gradlew bundleRelease assembleRelease --no-daemon
env:
CI: 'true'
KEYSTORE_LOCATION: ${{ steps.decode_keystore.outputs.filePath }}
CI_ANDROID_KEYSTORE_ALIAS: ${{ secrets.BITRISEIO_ANDROID_KEYSTORE_ALIAS }}
CI_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: ${{ secrets.BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
CI_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.BITRISEIO_ANDROID_KEYSTORE_PASSWORD }}
- name: Extract Version Number
run: echo "version=${GITHUB_REF#refs/tags/androidBuild/}" >> $GITHUB_ENV
- name: Upload Mapping File Artifact
uses: actions/upload-artifact@v4
with:
name: mapping-${{ env.version }}.txt
path: ./composeApp/build/outputs/mapping/release/mapping.txt
- name: Find APK file
run: |
apk_path=$(find ./composeApp/build/outputs/apk/release -name "OctoMeter-*.apk" | head -n 1)
echo "apk_path=$apk_path" >> $GITHUB_ENV
- name: Upload APK Artifact
uses: actions/upload-artifact@v4
with:
name: OctoMeter-${{ env.version }}.apk
path: ${{ env.apk_path }}
- name: Find AAB file
run: |
aab_path=$(find ./composeApp/build/outputs/bundle/release -name "OctoMeter-*.aab" | head -n 1)
echo "aab_path=$aab_path" >> $GITHUB_ENV
- name: Upload AAB Artifact
uses: actions/upload-artifact@v4
with:
name: OctoMeter-${{ env.version }}.aab
path: ${{ env.aab_path }}