Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Android workflows & refactor iOS KMP workflows #36

Merged
merged 34 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8164481
Add .gitignore
matejsemancik Dec 19, 2024
dce8102
Add universal-cloud-detect-changes.yml workflow
matejsemancik Dec 19, 2024
4f0a79b
Remove detect-changes steps from iOS KMP workflows
matejsemancik Dec 19, 2024
52bbfb2
Add android-cloud-check.yml workflow
matejsemancik Dec 19, 2024
a7e8faf
Add android-cloud-release-firebaseAppDistribution.yml workflow
matejsemancik Dec 20, 2024
acb8c88
Add JAVA_VERSION and JAVA_DISTRIBUTION inputs to android workflows
matejsemancik Dec 20, 2024
16d19bf
Reorder workflow inputs
matejsemancik Dec 20, 2024
8c1e243
Remove typo in YAML syntax
matejsemancik Dec 20, 2024
172c9a2
Fix command line breaks
matejsemancik Dec 20, 2024
38ce7af
Move signing credentials from inputs to secrets
matejsemancik Dec 20, 2024
90413b1
Add android-cloud-release-googlePlay.yml
matejsemancik Dec 20, 2024
6adfde1
Add ANDROID_ prefix to build number and version name env variables
matejsemancik Jan 6, 2025
4d51217
Set default KMP_FLAVOR to `prod` for Google Play release workflow
matejsemancik Jan 6, 2025
0472275
Update README.md
matejsemancik Jan 6, 2025
88465c5
Add CUSTOM_SECRETS and CUSTOM_SECRETS_FILE inputs to android publish …
matejsemancik Jan 6, 2025
fddf2f9
Fix double dollar sign typo
matejsemancik Jan 6, 2025
18bf890
Rename secrets inputs
matejsemancik Jan 6, 2025
22bbec0
Rename android-cloud-release-googlePlay.yml workflow
matejsemancik Jan 10, 2025
9ad7c0e
Fix shellcheck issues: quoting
matejsemancik Jan 10, 2025
beaf069
Fix shellcheck issues: env redirects
matejsemancik Jan 10, 2025
43bed54
Fix shellcheck issues: env redirects
matejsemancik Jan 10, 2025
05576ef
Quote experiment
matejsemancik Jan 27, 2025
17ec57c
Quote experiment
matejsemancik Jan 27, 2025
306310e
Revert "Quote experiment"
matejsemancik Jan 27, 2025
11f0a64
Revert "Quote experiment"
matejsemancik Jan 27, 2025
028f51a
Dump firebase credentials to file as part of Prepare Environment step
matejsemancik Jan 27, 2025
2a71335
Update firebase app distribution workflow: echo secrets with single q…
matejsemancik Jan 27, 2025
724eb22
Echo all secrets with single quote
matejsemancik Jan 27, 2025
2b89d8a
Modify the type of 'changesNotSentForReview' to JSON in the Android r…
matejsemancik Jan 27, 2025
1ad0c9d
Update README.md
matejsemancik Jan 27, 2025
4eb1a31
Update README.md
matejsemancik Jan 27, 2025
ac7e412
Rename detect-changes workflow file
matejsemancik Jan 29, 2025
42d7ff9
Refactor Android cloud release workflows: Change descriptions and add…
matejsemancik Jan 29, 2025
ef9bdb2
Fix optional field
matejsemancik Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/android-cloud-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Android Pull Request Check

on:
workflow_call:
inputs:
## Required Inputs
LINT_GRADLE_TASKS:
description: "A Gradle task(s) for executing lint check, for example `lintCheck lintRelease`"
required: true
type: string
TEST_GRADLE_TASKS:
description: "A Gradle task(s) for executing unit tests, for example `testReleaseUnitTest` or `testDevEnterpriseUnitTest`"
required: true
type: string

## Optional Inputs
TIMEOUT_MINUTES:
description: "Job timeout in minutes"
required: false
type: number
default: 30
JAVA_VERSION:
description: "Java version to use"
required: false
type: string
default: '17'
JAVA_DISTRIBUTION:
description: "Java distribution to use"
required: false
type: string
default: 'zulu'

jobs:
test:
name: Lint & Tests
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.TIMEOUT_MINUTES }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.JAVA_VERSION }}
distribution: ${{ inputs.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run Lint Check
shell: bash
run: ./gradlew --continue ${{ inputs.LINT_GRADLE_TASKS }}
- name: Run Unit Tests
shell: bash
run: ./gradlew --continue ${{ inputs.TEST_GRADLE_TASKS }}
- name: Danger action
uses: MeilCli/danger-action@v2
continue-on-error: true
with:
plugins_file: 'Gemfile'
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
env:
# The secrets.GITHUB_TOKEN is implicitly provided by trigger workflow
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146 changes: 146 additions & 0 deletions .github/workflows/android-cloud-release-firebaseAppDistribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Android Release to Firebase App Distribution

on:
workflow_call:
inputs:
## Required Inputs
TEST_GRADLE_TASKS:
description: "A Gradle task(s) for executing unit tests, for example `testReleaseUnitTest` or `testDevEnterpriseUnitTest`"
required: true
type: string
BUNDLE_GRADLE_TASK:
description: "A Gradle task for assembling app bundle, for example `bundleEnterprise`"
required: true
type: string
UPLOAD_GRADLE_TASK:
description: "A Gradle task for uploading APK, for example `appDistributionUploadEnterprise`"
required: true
type: string
SIGNING_KEYSTORE_PATH:
description: "Path to keystore for signing of universal APK. Example: `keystore/debug.jks' or 'androidApp/signing/debug.keystore'."
required: true
type: string
APP_DISTRIBUTION_GROUPS:
description: "Comma-separated list of app distribution group IDs"
required: true
type: string

## Optional Inputs
VERSION_NAME:
description: "Version name. Example: '1.X.X-snapshot'"
required: false
type: string
default: '1.X.X-snapshot'
BUILD_NUMBER_OFFSET:
description: "Build number offset. This number will be added to GITHUB_RUN_NUMBER and can be used to make corrections to build numbers."
required: false
type: number
default: 0
KMP_FLAVOR:
description: "KMP Build flavor. This is optional and only required by KMP projects and can be ignored on pure Android projects"
required: false
type: string
default: 'test'
SECRET_PROPERTIES_FILE:
description: "A path to file that fill be populated with contents of 'SECRET_PROPERTIES' secret. This file can be picked up by Secrets Gradle plugin to embed secrets into BuildConfig."
required: false
type: string
default: secrets.properties
TIMEOUT_MINUTES:
description: "Job timeout in minutes"
required: false
type: number
default: 30
JAVA_VERSION:
description: "Java version to use"
required: false
type: string
default: '17'
JAVA_DISTRIBUTION:
description: "Java distribution to use"
required: false
type: string
default: 'zulu'

secrets:
SIGNING_KEYSTORE_PASSWORD:
description: "Password to provided keystore"
required: true
SIGNING_KEY_ALIAS:
description: "Alias of the signing key in the provided keystore"
required: true
SIGNING_KEY_PASSWORD:
description: "Password to the key in the provided keystore"
required: true
APP_DISTRIBUTION_SERVICE_ACCOUNT:
required: true
description: "JSON key of service account with permissions to upload build to Firebase App Distribution"
SECRET_PROPERTIES:
required: false
description: "Custom string that contains key-value properties as secrets. Contents of this secret will be placed into file specified by 'SECRET_PROPERTIES_FILE' input."

jobs:
build:
name: Enterprise Build
runs-on: [ ubuntu-latest ]
timeout-minutes: ${{ inputs.TIMEOUT_MINUTES }}
env:
FIREBASE_CREDENTIALS_FILE: firebase_credentials.json
BUNDLETOOL_URL: https://github.com/google/bundletool/releases/download/1.17.2/bundletool-all-1.17.2.jar
EXCLUDE_AAB_FILTER: .*intermediate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.JAVA_VERSION }}
distribution: ${{ inputs.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Prepare Environment
run: |
{
echo "ANDROID_BUILD_NUMBER=$((GITHUB_RUN_NUMBER + ${{ inputs.BUILD_NUMBER_OFFSET}} ))";
echo "ANDROID_VERSION_NAME=${{ inputs.VERSION_NAME }}";
echo "KMP_FLAVOR=${{ inputs.KMP_FLAVOR }}"
} >> "$GITHUB_ENV"

echo '${{ secrets.SECRET_PROPERTIES }}' > ${{ inputs.SECRET_PROPERTIES_FILE }}
echo '${{ secrets.APP_DISTRIBUTION_SERVICE_ACCOUNT }}' > "$FIREBASE_CREDENTIALS_FILE"
- name: Run Unit tests
shell: bash
run: ./gradlew --continue ${{ inputs.TEST_GRADLE_TASKS }}
- name: Generate Artifacts (AAB and APK)
id: artifacts
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
shell: bash
run: |
./gradlew ${{ inputs.BUNDLE_GRADLE_TASK }} -P buildkonfig.flavor="$KMP_FLAVOR"
BUNDLE_FILE=$(find . -name '*.aab' | grep -v '.*intermediate')

wget -O bundletool.jar ${{ env.BUNDLETOOL_URL }}
java -jar bundletool.jar build-apks \
--bundle "$BUNDLE_FILE" \
--output universal.apks \
--mode universal \
--ks ${{ inputs.SIGNING_KEYSTORE_PATH }} \
--ks-pass pass:${{ secrets.SIGNING_KEYSTORE_PASSWORD }} \
--ks-key-alias ${{ secrets.SIGNING_KEY_ALIAS }} \
--key-pass pass:${{ secrets.SIGNING_KEY_PASSWORD }}
unzip universal.apks -d universal_apk
UNIVERSAL_APK_FILE=$(find universal_apk/ -name '*.apk')

echo "bundle_file=$BUNDLE_FILE" >> "$GITHUB_OUTPUT"
echo "universal_apk_file=$UNIVERSAL_APK_FILE" >> "$GITHUB_OUTPUT"
- name: Upload to Firebase App Distribution
shell: bash
run: |
./gradlew ${{ inputs.UPLOAD_GRADLE_TASK }} \
--serviceCredentialsFile="$FIREBASE_CREDENTIALS_FILE" \
--groups="${{ inputs.APP_DISTRIBUTION_GROUPS }}" \
--artifactType="APK" \
--artifactPath="${{ steps.artifacts.outputs.universal_apk_file }}"
132 changes: 132 additions & 0 deletions .github/workflows/android-cloud-release-googlePlay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Android Release to Google Play

on:
workflow_call:
inputs:
## Required Inputs
VERSION_NAME:
description: "Build version name"
required: true
type: string
BUNDLE_GRADLE_TASK:
description: "A Gradle task for assembling app bundle, for example `bundleRelease`"
required: true
type: string
SIGNING_KEYSTORE_PATH:
description: "Path to keystore for signing of universal APK. Example: `keystore/debug.jks' or 'androidApp/signing/debug.keystore'"
required: true
type: string
GOOGLE_PLAY_APPLICATION_ID:
description: "Google Play applicationId"
required: true
type: string
GOOGLE_PLAY_WHATSNEW_DIRECTORY:
description: "Path to directory with changelog files according to documentation in https://github.com/r0adkll/upload-google-play"
required: true
type: string

## Optional Inputs
BUILD_NUMBER_OFFSET:
description: "Build number offset. This number will be added to GITHUB_RUN_NUMBER and can be used to make corrections to build numbers."
required: false
type: number
default: 0
KMP_FLAVOR:
description: "KMP Build flavor. This is optional and only required by KMP projects and can be ignored on pure Android projects"
required: false
type: string
default: 'prod'
SECRET_PROPERTIES_FILE:
description: "A path to file that fill be populated with contents of 'SECRET_PROPERTIES' secret. This file can be picked up by Secrets Gradle plugin to embed secrets into BuildConfig."
required: false
type: string
default: secrets.properties
CHANGES_NOT_SENT_FOR_REVIEW:
description: 'A changesNotSentForReview Google Play flag. Enable when last google review failed, disable when last review was successful.'
type: boolean
required: false
default: false
TIMEOUT_MINUTES:
description: "Job timeout in minutes"
required: false
type: number
default: 30
JAVA_VERSION:
description: "Java version to use"
required: false
type: string
default: '17'
JAVA_DISTRIBUTION:
description: "Java distribution to use"
required: false
type: string
default: 'zulu'

secrets:
SIGNING_KEYSTORE_PASSWORD:
description: "Password to provided keystore"
required: true
SIGNING_KEY_ALIAS:
description: "Alias of the signing key in the provided keystore"
required: true
SIGNING_KEY_PASSWORD:
description: "Password to the key in the provided keystore"
required: true
GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT:
required: true
description: "JSON key of service account with permissions to upload build to Google Play"
SECRET_PROPERTIES:
required: false
description: "Custom string that contains key-value properties as secrets. Contents of this secret will be placed into file specified by 'SECRET_PROPERTIES_FILE' input."

jobs:
build:
name: Release Build
runs-on: [ ubuntu-latest ]
timeout-minutes: ${{ inputs.TIMEOUT_MINUTES }}
env:
EXCLUDE_AAB_FILTER: .*intermediate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.JAVA_VERSION }}
distribution: ${{ inputs.JAVA_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Prepare Environment
run: |
{
echo "ANDROID_BUILD_NUMBER=$((GITHUB_RUN_NUMBER + ${{ inputs.BUILD_NUMBER_OFFSET}} ))";
echo "ANDROID_VERSION_NAME=${{ inputs.VERSION_NAME }}";
echo "KMP_FLAVOR=${{ inputs.KMP_FLAVOR }}"
} >> "$GITHUB_ENV"

echo '${{ secrets.SECRET_PROPERTIES }}' > ${{ inputs.SECRET_PROPERTIES_FILE }}
- name: Generate Artifacts (AAB)
id: artifacts
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
shell: bash
run: |
./gradlew ${{ inputs.BUNDLE_GRADLE_TASK }} -P buildkonfig.flavor="$KMP_FLAVOR"
BUNDLE_FILE=$(find . -name '*.aab' | grep -v '.*intermediate')
MAPPING_FILE=$(find . -name mapping.txt)

echo "bundle_file=$BUNDLE_FILE" >> "$GITHUB_OUTPUT"
echo "mapping_file=$MAPPING_FILE" >> "$GITHUB_OUTPUT"
- name: Upload to Google Play
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_PUBLISH_SERVICE_ACCOUNT }}
packageName: ${{ inputs.GOOGLE_PLAY_APPLICATION_ID }}
releaseFiles: ${{ steps.artifacts.outputs.bundle_file }}
track: internal
status: draft
whatsNewDirectory: ${{ inputs.GOOGLE_PLAY_WHATSNEW_DIRECTORY }}
mappingFile: ${{ steps.artifacts.outputs.mapping_file }}
changesNotSentForReview: ${{ toJSON(inputs.CHANGES_NOT_SENT_FOR_REVIEW) }}
Loading