Skip to content

Commit

Permalink
chore: streamline workflow & fastlane around deployment
Browse files Browse the repository at this point in the history
Optimize action execution time by consolidating testing and deployment upon tag push events
  • Loading branch information
wax911 committed Dec 24, 2024
1 parent bc34946 commit c6f7f71
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/fastlane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ gpg -d --passphrase "$GOOGLE_SERVICES_PASSPHRASE" --batch google-services.json.a
echo "$PLAYSTORE_SERVICE_ACCOUNT" > playstore-service-account.json.asc
gpg -d --passphrase "$PLAYSTORE_SERVICE_ACCOUNT_PASSPHRASE" --batch playstore-service-account.json.asc > app/playstore-service-account.json

bundle exec fastlane deploy
bundle exec fastlane deploy skip_tests:false
17 changes: 6 additions & 11 deletions .github/workflows/android-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,11 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
distribution: 'zulu'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.3'
bundler-cache: true
- name: Fetch tags
run: git fetch --tags --force
- name: Wait for tests to succeed
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
running-workflow-name: android-build
check-name: android-unit-test-release
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Build release APKs
run: bash .github/scripts/fastlane.sh
env:
Expand Down Expand Up @@ -58,3 +48,8 @@ jobs:
gh release upload "${{ github.ref_name }}" $files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
32 changes: 0 additions & 32 deletions .github/workflows/android-unit-test-release.yaml

This file was deleted.

13 changes: 9 additions & 4 deletions .github/workflows/android-unit-test.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: android-unit-test

on:
push:
branches:
- '*'
branches: [ develop ]
pull_request:
branches:
- '*'
Expand All @@ -16,8 +16,13 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
distribution: 'zulu'
- name: Configure properties
run: bash .github/scripts/setup-config.sh
- name: Test with Gradle
run: ./gradlew test
run: ./gradlew test --stacktrace
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
56 changes: 33 additions & 23 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,57 @@
default_platform(:android)

platform :android do
desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do

apk_path = "app/build/outputs/apk/app/release/app-release.apk"
skip_metadata_upload = 'true'

desc "Test with gradle"
lane :verify do
gradle(
task: "assemble",
build_type: "Release",
task: "test"
)
upload_to_play_store(
release_status: 'completed',
track: 'beta',
rollout: '1.0',
apk: 'app/build/outputs/apk/app/release/app-release.apk',
skip_upload_images: 'true',
skip_upload_metadata: 'true',
)

# sh "your_script.sh"
# You can also use other beta testing services here
end

desc "Deploy a new version to the Google Play"
lane :deploy do
desc "Prepare release builds"
lane :build do
gradle(
task: "assemble",
build_type: "Release",
)
end

desc "Submit a new Beta Build to Google Play"
lane :submit_beta do
upload_to_play_store(
release_status: 'completed',
track: 'beta',
rollout: '1.0',
apk: 'app/build/outputs/apk/app/release/app-release.apk',
skip_upload_images: 'true',
skip_upload_metadata: 'true',
apk: apk_path,
skip_upload_images: skip_metadata_upload,
skip_upload_metadata: skip_metadata_upload,
)
end

desc "Submit a new Prod Build to Google Play"
lane :submit_prod do
upload_to_play_store(
release_status: 'draft',
track: 'production',
apk: 'app/build/outputs/apk/app/release/app-release.apk',
skip_upload_images: 'true',
skip_upload_metadata: 'true',
apk: apk_path,
skip_upload_images: skip_metadata_upload,
skip_upload_metadata: skip_metadata_upload,
)
end

desc "Deploy builds to Google Play"
lane :deploy do |options|
if options[:skip_tests].nil? || !options[:skip_tests]
verify
end

build
submit_beta
submit_prod
end

end
64 changes: 64 additions & 0 deletions fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
fastlane documentation
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```sh
xcode-select --install
```

For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

## Android

### android verify

```sh
[bundle exec] fastlane android verify
```

Test with gradle

### android build

```sh
[bundle exec] fastlane android build
```

Prepare release builds

### android submit_beta

```sh
[bundle exec] fastlane android submit_beta
```

Submit a new Beta Build to Google Play

### android submit_prod

```sh
[bundle exec] fastlane android submit_prod
```

Submit a new Prod Build to Google Play

### android deploy

```sh
[bundle exec] fastlane android deploy
```

Deploy builds to Google Play

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

0 comments on commit c6f7f71

Please sign in to comment.