-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configured Fastlane & CI Workflow for publishing app to Play Store & …
…GitHub (#1761) * Configured CI/CD And Fastlane to Release App to Play Store This commit introduces a comprehensive CI/CD pipeline using Github Actions and Fastlane. The following workflows have been added: - **On Push:** Builds, archives, and creates Github pre-releases for beta builds. Deploys to Playstore internal track and promotes to beta if specified. - **Play Publish:** Builds and deploys to Playstore internal track. Optionally promotes to beta. - ** Production Deploy:** Promotes beta releases to production on the Playstore. - **Bump our Calendar Version:** Creates monthly releases. - **Tag Weekly Release:** Tags weekly releases and triggers the On Push workflow for beta builds. Additionally, Fastlane has been configured to handle deployments to the Playstore and Amazon Appstore. Secret inflation and release note generation have been automated using Github Actions. * Configured CI/CD And Fastlane to Release App to Play Store This commit introduces a comprehensive CI/CD pipeline using Github Actions and Fastlane. The following workflows have been added: - **On Push:** Builds, archives, and creates Github pre-releases for beta builds. Deploys to Playstore internal track and promotes to beta if specified. - **Play Publish:** Builds and deploys to Playstore internal track. Optionally promotes to beta. - ** Production Deploy:** Promotes beta releases to production on the Playstore. - **Bump our Calendar Version:** Creates monthly releases. - **Tag Weekly Release:** Tags weekly releases and triggers the On Push workflow for beta builds. Additionally, Fastlane has been configured to handle deployments to the Playstore and Amazon Appstore. Secret inflation and release note generation have been automated using Github Actions. * fix: Improved pre-commit and pre-push scripts * Updated Badging * Updated Badging
- Loading branch information
Showing
23 changed files
with
824 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: 'Create Release Notes' | ||
description: 'Creates the current releases release notes' | ||
inputs: | ||
tag-name: | ||
description: 'Name of the tag that will be used for this release' | ||
required: true | ||
gh-token: | ||
description: 'The GitHub token used to get details from the API' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Get Previous Release Tag | ||
uses: actions/github-script@v7 | ||
id: latest-release-tag | ||
with: | ||
github-token: ${{ inputs.gh-token }} | ||
result-encoding: string | ||
script: | | ||
const { data } = await github.rest.repos.getLatestRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
return data.tag_name | ||
- name: Get Generated Release Notes | ||
uses: actions/github-script@v7 | ||
id: generate-notes | ||
with: | ||
github-token: ${{ inputs.gh-token }} | ||
result-encoding: string | ||
script: | | ||
const { data } = await github.rest.repos.generateReleaseNotes({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: '${{ inputs.tag-name }}', | ||
target_commitish: 'dev', | ||
previous_tag_name: '${{ steps.latest-release-tag.outputs.result }}', | ||
}) | ||
return data.body.replaceAll('`', '\'').replaceAll('"', '\'') | ||
- name: Generate Release Notes | ||
id: version-generator | ||
shell: bash | ||
run: | | ||
mkdir -p ./app/build/outputs/ | ||
echo "Previous Release Tag:" | ||
echo "${{ steps.latest-release-tag.outputs.result }}" | ||
echo "Full Changelog:" | ||
CHANGELOG="${{ steps.generate-notes.outputs.result }}" | ||
echo -e "$CHANGELOG" | ||
printf "$CHANGELOG" > ./mifospay/build/outputs/changelogGithub | ||
echo "Beta Changelog:" | ||
git log --format="* %s" HEAD^..HEAD | ||
git log --format="* %s" HEAD^..HEAD > ./mifospay/build/outputs/changelogBeta |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Create Release Numbers' | ||
description: 'Creates the current release number based on checked out code' | ||
outputs: | ||
version-code: | ||
description: 'The numeric app version' | ||
value: ${{ steps.version-generator.outputs.version-code }} | ||
version: | ||
description: 'The app version' | ||
value: ${{ steps.version-generator.outputs.version }} | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set Build Number | ||
id: version-generator | ||
shell: bash | ||
run: | | ||
./gradlew versionFile | ||
COMMITS=`git rev-list --count HEAD` | ||
TAGS=`git tag | grep -v beta | wc -l` | ||
VC=$((((COMMITS+TAGS) * 3) << 1)) | ||
echo Number Commits $COMMITS | ||
echo Number Tags $TAGS | ||
echo Version Code $VC | ||
echo "version-code=$VC" >> $GITHUB_OUTPUT | ||
VERSION=`cat version.txt` | ||
echo Version $VERSION | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 'Inflate Secrets' | ||
description: 'Inflates the secret values into the appropriate files' | ||
inputs: | ||
keystore: | ||
description: 'The keystore to inflate' | ||
required: true | ||
google-services: | ||
description: 'The google-services.json to inflate' | ||
required: true | ||
playstore-creds: | ||
description: 'The playstore credentials to inflate' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Mock debug google-services.json | ||
shell: bash | ||
run: | | ||
cp .github/mock-google-services.json mifospay/src/demo/google-services.json | ||
cp .github/mock-google-services.json mifospay/src/prod/google-services.json | ||
- name: Inflate release_keystore.keystore | ||
shell: bash | ||
env: | ||
KEYSTORE: ${{ inputs.keystore }} | ||
run: | | ||
echo $KEYSTORE | base64 --decode > mifospay/release_keystore.keystore | ||
- name: Inflate google-services.json | ||
shell: bash | ||
env: | ||
GOOGLE_SERVICES: ${{ inputs.google-services }} | ||
run: | | ||
echo $GOOGLE_SERVICES > mifospay/google-services.json | ||
- name: Inflate playStorePublishServiceCredentialsFile.json | ||
shell: bash | ||
env: | ||
CREDS: ${{ inputs.playstore-creds }} | ||
run: | | ||
echo $CREDS > mifospay/playStorePublishServiceCredentialsFile.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "project_number", | ||
"firebase_url": "firebase_url", | ||
"project_id": "project_id", | ||
"storage_bucket": "storage_bucket" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "mobilesdk_app_id", | ||
"android_client_info": { | ||
"package_name": "org.mifospay" | ||
} | ||
}, | ||
"api_key": [ | ||
{ | ||
"current_key": "current_key" | ||
} | ||
] | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "mobilesdk_app_id", | ||
"android_client_info": { | ||
"package_name": "org.mifospay.demo.debug" | ||
} | ||
}, | ||
"api_key": [ | ||
{ | ||
"current_key": "current_key" | ||
} | ||
] | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "mobilesdk_app_id", | ||
"android_client_info": { | ||
"package_name": "org.mifospay.demo" | ||
} | ||
}, | ||
"api_key": [ | ||
{ | ||
"current_key": "current_key" | ||
} | ||
] | ||
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "mobilesdk_app_id", | ||
"android_client_info": { | ||
"package_name": "org.mifospay.debug" | ||
} | ||
}, | ||
"api_key": [ | ||
{ | ||
"current_key": "current_key" | ||
} | ||
] | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Bump our Calendar Version | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '30 3 1 * *' | ||
jobs: | ||
tag: | ||
name: Tag Monthly Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get Current Time | ||
uses: josStorer/get-current-time@v2.1.2 | ||
id: current-time | ||
|
||
- name: Bump Calendar Version | ||
uses: rickstaa/action-create-tag@v1.7.2 | ||
with: | ||
tag: ${{ steps.current-time.outputs.year }}.${{ steps.current-time.outputs.month }}.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: On Push | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
beta: | ||
description: 'true if this is a beta release' | ||
required: false | ||
default: 'false' | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
SUPPLY_UPLOAD_MAX_RETRIES: 5 | ||
|
||
jobs: | ||
app_build: | ||
name: Github, Firebase, and Sentry Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4.2.2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' | ||
bundler-cache: true | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- uses: ./.github/actions/create-release-number | ||
name: Create Release Number | ||
id: rel_number | ||
|
||
- uses: ./.github/actions/inflate-secrets | ||
name: Inflate Secrets | ||
with: | ||
keystore: ${{ secrets.ORIGINAL_KEYSTORE_FILE }} | ||
google-services: ${{ secrets.GOOGLESERVICES }} | ||
playstore-creds: ${{ secrets.PLAYSTORECREDS }} | ||
|
||
- uses: ./.github/actions/create-release-notes | ||
name: Create Release Notes | ||
with: | ||
tag-name: ${{ steps.rel_number.outputs.version }} | ||
gh-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Release | ||
env: | ||
KEYSTORE_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }} | ||
KEYSTORE_ALIAS: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }} | ||
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }} | ||
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | ||
run: | | ||
./gradlew :mifospay:assembleRelease | ||
- name: Archive Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./**/*.apk | ||
|
||
- name: Create Version File | ||
if: github.event.inputs.beta == 'true' | ||
shell: bash | ||
env: | ||
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | ||
run: | | ||
echo $VERSION_CODE > ./app/build/outputs/version_code.txt | ||
- name: Create Github Pre-Release | ||
if: github.event.inputs.beta == 'true' | ||
uses: softprops/action-gh-release@v2.0.8 | ||
with: | ||
tag_name: ${{ steps.rel_number.outputs.version }} | ||
body_path: ./app/build/outputs/changelogGithub | ||
draft: false | ||
prerelease: true | ||
files: | | ||
./mifospay/build/outputs/apk/demo/release/mifospay-demo-release.apk | ||
./mifospay/build/outputs/apk/prod/release/mifospay-prod-release.apk | ||
./mifospay/build/outputs/version_code.txt | ||
- name: Print `git status` | ||
run: git status | ||
|
||
play_publish: | ||
name: Play Publish | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: playstore_deploy | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4.2.2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' | ||
bundler-cache: true | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- uses: ./.github/actions/create-release-number | ||
name: Create Release Number | ||
id: rel_number | ||
|
||
- uses: ./.github/actions/inflate-secrets | ||
name: Inflate Secrets | ||
with: | ||
keystore: ${{ secrets.UPLOAD_KEYSTORE_FILE }} | ||
google-services: ${{ secrets.GOOGLESERVICES }} | ||
playstore-creds: ${{ secrets.PLAYSTORECREDS }} | ||
|
||
- uses: ./.github/actions/create-release-notes | ||
name: Create Release Notes | ||
with: | ||
tag-name: ${{ steps.rel_number.outputs.version }} | ||
gh-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build Release | ||
env: | ||
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }} | ||
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }} | ||
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }} | ||
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | ||
run: | | ||
./gradlew :mifospay:bundleRelease | ||
- name: Deploy to Playstore Internal | ||
run: bundle exec fastlane deploy_internal | ||
|
||
- name: Promote Internal to Beta | ||
if: github.event.inputs.beta == 'true' | ||
run: bundle exec fastlane promote_to_beta |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Production Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [ released ] | ||
|
||
env: | ||
SUPPLY_UPLOAD_MAX_RETRIES: 5 | ||
|
||
jobs: | ||
play_promote_production: | ||
name: Play Publish Production | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' | ||
bundler-cache: true | ||
|
||
- uses: ./.github/actions/inflate-secrets | ||
name: Inflate Secrets | ||
with: | ||
keystore: ${{ secrets.ORIGINAL_KEYSTORE_FILE }} | ||
google-services: ${{ secrets.GOOGLESERVICES }} | ||
playstore-creds: ${{ secrets.PLAYSTORECREDS }} | ||
|
||
- name: Promote Beta to Production Play Store | ||
run: bundle exec fastlane promote_to_production |
Oops, something went wrong.