Wrap link #34
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: Publish | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
test: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Grand execute permissions to gradlew | |
run: chmod +x gradlew | |
- name: Run unit tests | |
run: ./gradlew testDebug | |
apk: | |
name: Generate APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Grand execute permissions to gradlew | |
run: chmod +x gradlew | |
- name: Assemble app debug APK | |
run: ./gradlew assembleDebug | |
- name: Upload app APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-debug | |
path: app/build/outputs/apk/debug/app-debug.apk | |
- name: Assemble app instrumental tests | |
run: ./gradlew assembleDebugAndroidTest | |
- name: Upload app test APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-debug-androidTest | |
path: app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk | |
firebase: | |
name: Run UI tests with firebase Test Lab | |
needs: [ apk ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download app APK | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-debug | |
- name: Download app test APK | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-debug-androidTest | |
- name: 'Google Cloud Auth' | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.GOOGLE_SERVICES_JSON }}' | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ secrets.SOME_PROJECT_ID }} | |
service_account_key: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
export_default_credentials: true | |
- name: Run instrumental tests in Firebase Test Lab | |
run: gcloud firebase test android run --type instrumentation --app app-debug/app-debug.apk --test app-debug-androidTest/app-debug-androidTest.apk --device model=blueline,version=28 | |
distribute: | |
name: Distribute app bundle to Play Store | |
needs: [ firebase ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Bump version | |
uses: chkfung/android-version-actions@v1.2.3 | |
with: | |
gradlePath: app/build.gradle.kts | |
versionCode: ${{ github.run_number }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Assemble Release Bundle | |
run: ./gradlew bundleRelease | |
- name: Sign Release | |
uses: r0adkll/sign-android-release@v1.0.4 | |
with: | |
releaseDirectory: app/build/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.ANDROID_KEYSTORE }} | |
alias: ${{ secrets.SOME_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.SOME_KEY_PASSWORD }} | |
# - name: Setup authorization with Google Play Store | |
# run: echo '${{ secrets.GOOGLE_SERVICES_API }}' > service_account.json | |
# | |
# - name: Deploy to Internal | |
# uses: r0adkll/upload-google-play@v1 | |
# with: | |
# serviceAccountJson: service_account.json | |
# packageName: dev.m13d.somenet | |
# releaseFiles: app/build/outputs/bundle/release/app-release.aab | |
# track: internal | |
# whatsNewDirectory: whatsNewDirectory/ |