154 lines
5.4 KiB
YAML
154 lines
5.4 KiB
YAML
name: Internal Release
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
# Triggers the workflow on push of version tag
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
internal_release:
|
|
# The type of runner that the job will run on
|
|
# Runs on macos-latest because Android Emulator won't HAXM hardware acceleration on Ubuntu
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- name: Checkout GIT
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 #Fetch all history for all branches and tags
|
|
|
|
- name: Setup Java SDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'adopt'
|
|
java-version: '18'
|
|
|
|
- name: Setup Ruby (for Fastlane)
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.2'
|
|
|
|
- name: Install Fastlane
|
|
run: bundle install
|
|
#----------------------------------------------------
|
|
|
|
#Security
|
|
- name: Validate Gradle Wrapper checksum
|
|
uses: gradle/wrapper-validation-action@v2
|
|
|
|
- name: Make Gradle Wrapper (gradlew) executable
|
|
run: chmod +x gradlew
|
|
#----------------------------------------------------
|
|
|
|
#Optimization
|
|
- name: Enable Gradle Wrapper caching (optmization)
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
#---------------------------------------------------
|
|
|
|
#Run Unit Tests (Unit tests can be run by Fastlane)
|
|
#- name: Run Unit tests
|
|
# working-directory: ./app
|
|
# run: ./gradlew testDebugUnitTest
|
|
#-------------------------------------------------------------------
|
|
|
|
#Decode Secrets for production build
|
|
- name: Create JKS for prod signing
|
|
run: |
|
|
echo "$SIGNING_KEYSTORE_JKS" > sign.jks.b64
|
|
base64 -d -i sign.jks.b64 > sign.jks
|
|
env:
|
|
SIGNING_KEYSTORE_JKS: ${{ secrets.SIGNING_KEYSTORE }}
|
|
|
|
- name: Create Google Play Config file
|
|
run: |
|
|
echo "$PLAY_CONFIG_JSON" > play_config.json.b64
|
|
base64 -d -i play_config.json.b64 > google-play-console-user.json
|
|
env:
|
|
PLAY_CONFIG_JSON: ${{ secrets.GOOGLE_PLAY_CONSOLE_JSON }}
|
|
|
|
- name: List created files for DEBUG purposes
|
|
run: ls -ll
|
|
#--------------------------------------------------------------------------------
|
|
|
|
#Run UI tests & Lint analysis
|
|
- name: Verify that the code is release-able ("lintRelease")
|
|
run: bundle exec fastlane lint_release
|
|
|
|
- name: Upload Lint Release report to GitHub
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: lint-release-report.html
|
|
path: app/build/reports/lint-results-release.html
|
|
|
|
#- name: Run UI Tests
|
|
# uses: reactivecircus/android-emulator-runner@v2
|
|
# with:
|
|
# api-level: 29
|
|
# script: bundle exec fastlane ui_tests
|
|
|
|
#- name: Upload Android Tests report to GitHub
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: android-tests-report
|
|
# path: app/build/reports/androidTests/connected
|
|
#--------------------------------------------------------------------------
|
|
|
|
#Fastlane: Build production .aab and release it to Internal Testing
|
|
- name: Build production App Bundle
|
|
run: bundle exec fastlane production_build
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
|
|
|
- name: Upload App Bundle to GitHub
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-release.aab
|
|
path: app/build/outputs/bundle/release/app-release.aab
|
|
|
|
- name: Release App Bundle to Internal Testing
|
|
run: bundle exec fastlane internal_release
|
|
env:
|
|
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
|
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
|
|
#--------------------------------------------------------------------------
|
|
|
|
#Create GitHub release
|
|
# Bullrich/generate-release-changelog@master doesn't run on macos-latest
|
|
- name: Prepare changelog for GitHub Release
|
|
uses: Bullrich/generate-release-changelog@master
|
|
id: Changelog
|
|
env:
|
|
REPO: ${{ github.repository }}
|
|
|
|
- name: Create GitHub Release
|
|
if: always() #Execute even the generation of changelog has failed
|
|
id: create_release
|
|
uses: actions/create-release@latest
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
body: |
|
|
${{ steps.Changelog.outputs.changelog }}
|
|
draft: false
|
|
prerelease: false
|