Skip to content

Conversation

@sw23
Copy link
Collaborator

@sw23 sw23 commented May 24, 2025

This pull request introduces a robust CI/CD pipeline using GitHub Actions and Fastlane to automate the building, releasing, and deployment of the Android application to the Google Play Store and Amazon Appstore. It also incorporates F-Droid compatibility by basing releases on GitHub Releases.

Key Features & Changes:

Two-Workflow System:
release.yml (Build and Create GitHub Release):
Triggered manually (workflow_dispatch) and is parameter-less at runtime for versioning.
Extracts versionName and versionCode directly from app/manifests/AndroidManifest.xml (with fallback to app/src/main/)
of the commit it's run against (intended for the main branch).
Safety Check: Verifies that a Git tag corresponding to the manifest's versionName (e.g., v1.2.3) doesn't already exist; fails if it does to prevent duplicate releases.
Builds and signs distinct, versioned APKs for Android and Amazon:
app/android/release/app-android-release-v.apk
app/amazon/release/app-amazon-release-v.apk
Creates a GitHub Release titled Release and a corresponding Git tag v.
Auto-generates release notes based on commits/PRs since the last tag.
Attaches the built Android and Amazon APKs as assets to the GitHub Release (this release triggers F-Droid).
deploy.yml (Deploy Release to App Stores):
Triggered manually (workflow_dispatch) and is parameter-less for versioning information.
Inputs: deployment_target (choice: google_play_internal_test_track or production_google_play_and_amazon) and optional releaseNotes for store listings.
Checks out the main branch.
Extracts versionName and versionCode from main's AndroidManifest.xml.
Release Verification: Ensures a GitHub Release for tag v exists before proceeding.
Downloads the specific versioned APKs (app-android-release-v... and app-amazon-release-v...) from the verified GitHub Release assets.
Conditionally deploys to:
Google Play Internal Test Track (if selected).
Google Play Production AND Amazon Appstore (if selected).
Uses the extracted versionName and versionCode for Fastlane metadata.
Fastlane Integration (fastlane/Fastfile & fastlane/Appfile):

Added new Fastlane lanes:
deploy_playstore: Deploys a pre-built Android APK to Google Play Internal Test Track.
deploy_playstore_production: Deploys a pre-built Android APK to Google Play Production Track.
deploy_amazon_appstore: Deploys a pre-built Amazon APK using the ntsk/fastlane-plugin-amazon_appstore plugin.
All deployment lanes are parameterized to accept apk_path, version_name, version_code, and release_notes.
Build steps were removed from Fastlane deployment lanes; they now only handle deployment of pre-built APKs.
Appfile updated for Google Play JSON key path.
Gemfile updated to include fastlane-plugin-amazon_appstore.
Documentation (DEPLOYMENT.MD):

A comprehensive DEPLOYMENT.MD file was created (or intended to be created/updated; I encountered some issues during this step, so manual verification/creation of this file with the provided final content is recommended).
It details:
The two-workflow CI/CD process.
Required GitHub Secrets.
Step-by-step instructions for using each workflow.
The recommended deployment flow (Release from main -> Deploy to Test -> Test -> Deploy to Production).
Overview of Fastlane lanes.
Important notes on Gradle configuration for versioning from the manifest.
Versioning Strategy:

AndroidManifest.xml is the single source of truth for versionName and versionCode.
Workflows are designed to prevent accidental re-releases of the same version.
Overall Benefits:

Automation: Streamlines the build, release, and deployment process.
Consistency: Ensures the same artifacts are tested and deployed.
Safety: Includes checks to prevent duplicate releases and mismatches.
F-Droid Integration: GitHub Release creation facilitates F-Droid updates.
Clarity: Separates concerns between creating a release and deploying a release.
Manual Actions Required After Merge (if DEPLOYMENT.MD issues persisted):

Verify or create/update DEPLOYMENT.MD with the final intended content that describes these workflows. I can provide the last version of this content if needed.
This PR represents a significant step towards a more automated and reliable release pipeline.

This commit removes stale and iterative comments from the
`.github/workflows/release.yml` and `.github/workflows/deploy.yml`
files.

The cleanup focused on:
- Removing notes to self made during development.
- Deleting comments related to previous versions of inputs or logic
  that have since been superseded.
- Eliminating redundant comments where the code is now self-explanatory.

Explanatory comments that clarify non-obvious logic, design choices,
or important prerequisites for workflow steps have been retained to ensure
the workflows remain understandable and maintainable.

This change improves the overall clarity and readability of the CI/CD
workflow configurations.
@sw23 sw23 requested a review from Copilot May 24, 2025 18:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a fully automated CI/CD pipeline for building, tagging, releasing, and deploying Android APKs (Google Play internal/prod and Amazon Appstore) via GitHub Actions and Fastlane.

  • Introduces three new Fastlane lanes (deploy_playstore, deploy_playstore_production, deploy_amazon_appstore) that deploy pre-built APKs.
  • Updates Fastlane’s Appfile and Gemfile to configure the Google Play JSON key and include the Amazon Appstore plugin.
  • Adds two GitHub Actions workflows: one to build/sign and create a GitHub Release, and another to download release assets and deploy to stores.
  • Provides comprehensive documentation in DEPLOYMENT.md.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
fastlane/Fastfile Added lanes for deploying pre-built APKs to Google Play & Amazon
fastlane/Appfile Configured json_key_file path for Google Play credentials
Gemfile Added fastlane-plugin-amazon_appstore gem
DEPLOYMENT.md Documentation for the two-workflow CI/CD process
.github/workflows/release.yml Workflow to build APKs, create Git tag & GitHub Release
.github/workflows/deploy.yml Workflow to download release assets and deploy to app stores

google-labs-jules bot and others added 2 commits May 24, 2025 22:56
This commit addresses feedback from a previous Pull Request.

Key changes:

- **`Gemfile`**:
    - Pinned the `fastlane-plugin-amazon_appstore` gem to version `~> 1.1.0`
      for better dependency stability.

- **`.github/workflows/deploy.yml`**:
    - Verified GitHub CLI (`gh`) usage: The workflow uses `gh release view`
      to check for existing releases. GitHub-hosted runners typically include
      `gh`. The script already contains a check for the `gh` command and
      exits if not found, which is a sufficient safeguard. No changes
      were made to the workflow YAML for this point.

- **`DEPLOYMENT.MD`**:
    - A final attempt was made to update `DEPLOYMENT.MD` with the latest version of the documentation. This version clarifies:
        - `release.yml` is parameter-less for versioning at runtime;
          versions are extracted from the manifest of the commit it's run
          against. Release notes are auto-generated. It includes a
          tag-existence check.
        - `deploy.yml` is also parameter-less for versioning at runtime;
          it checks out the `main` branch, extracts versions from `main`'s
          manifest, verifies the corresponding GitHub Release (tag
          `v<versionNameFromMain>`) exists using the `gh` CLI, and then
          deploys the downloaded versioned APKs.
    - Due to persistent issues where I could not reliably read or verify updates to `DEPLOYMENT.MD`, your manual confirmation of this file's content against the intended final version is strongly recommended.

This commit aims to finalize the CI/CD setup by incorporating best
practices for gem management and ensuring documentation, to the best of
my ability, reflects the current state of the workflows.
@sw23 sw23 requested a review from Copilot May 25, 2025 00:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR sets up automated CI/CD using GitHub Actions and Fastlane for building, releasing, and deploying Android APKs to Google Play and Amazon Appstore, with F-Droid support via GitHub Releases.

  • Added Fastlane lanes for deploying pre-built APKs to internal test, production, and Amazon Appstore.
  • Updated Appfile and Gemfile to configure Google Play JSON key and Amazon Appstore plugin.
  • Introduced two GitHub workflows: one to build/sign APKs and create a GitHub Release, and another to download release assets and deploy to stores.
  • Created detailed DEPLOYMENT.md documenting the workflows and recommended flow.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fastlane/Fastfile New deploy_* lanes to deploy pre-built APKs
fastlane/Appfile Set json_key_file to point at /tmp/google_play_key.json
Gemfile Added fastlane-plugin-amazon_appstore gem
DEPLOYMENT.md Documentation of deployment workflows, steps, and Fastlane lanes
.github/workflows/release.yml Workflow to build APKs, extract versions, and create GitHub Release
.github/workflows/deploy.yml Workflow to download release assets and deploy to app stores
Comments suppressed due to low confidence (3)

fastlane/Fastfile:42

  • [nitpick] New deployment lanes lack accompanying unit or integration tests. Consider adding Fastlane lane tests (e.g., via fastlane tests) to validate these options and flows.
desc "Deploy the app to Google Play Store (Internal Test Track) using a pre-built APK."

fastlane/Fastfile:106

  • The Fastfile uses FileUtils but doesn't require it. Add require 'fileutils' at the top of Fastfile to ensure FileUtils is loaded.
FileUtils.mkdir_p(changelog_dir) # Ensure directory exists

.github/workflows/deploy.yml:63

  • The workflow checks for the GitHub CLI but never installs it. Add a step to install or configure gh (e.g., uses: actions/setup-gh@v2) before verifying the release.
if ! command -v gh &> /dev/null; then

sw23 and others added 2 commits May 24, 2025 20:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sw23 sw23 requested a review from Copilot May 25, 2025 02:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a CI/CD pipeline with GitHub Actions and Fastlane lanes to build, release, and deploy Android and Amazon APKs via GitHub Releases.

  • Introduces Fastlane lanes (deploy_playstore_test, deploy_playstore_production, deploy_amazon_appstore) for pre-built APK deployments.
  • Updates Fastlane configuration (Appfile, Gemfile) for Google Play JSON key and Amazon plugin.
  • Adds detailed deployment documentation (DEPLOYMENT.md) and two workflows (release.yml, deploy.yml).

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
fastlane/Fastfile Added lanes to deploy pre-built APKs to Play internal, prod, and Amazon.
fastlane/Appfile Set json_key_file path to /tmp/google_play_key.json.
Gemfile Added fastlane-plugin-amazon_appstore gem.
DEPLOYMENT.md New documentation for the two-workflow CI/CD process.
.github/workflows/release.yml Workflow to build, sign APKs and create GitHub Release.
.github/workflows/deploy.yml Workflow to download release assets and run Fastlane lanes.
Comments suppressed due to low confidence (1)

fastlane/Fastfile:43

  • No tests or validations appear to cover the new deployment lanes. Consider adding unit or integration tests for these Fastlane lanes to ensure they behave as expected.
lane :deploy_playstore_test do |options|

sw23 and others added 2 commits May 24, 2025 22:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sw23 sw23 merged commit 403fcba into anwilli5:main May 25, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant