Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
102 changes: 99 additions & 3 deletions .github/workflows/release_update.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Release update

on:
push:
branches:
- "**"
paths:
- "fastlane/**"
- ".github/workflows/release_update.yml"
workflow_dispatch:
inputs:
mode:
Expand All @@ -25,6 +31,7 @@ on:

jobs:
release_update:
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
GITHUB_ACCESS_KEY: ${{ secrets.GH_ACCESS_KEY }}
Expand Down Expand Up @@ -101,7 +108,7 @@ jobs:
bundle exec fastlane release_update_batch subdomains:"${{ github.event.inputs.subdomains }}" release_option:${{ github.event.inputs.release_option }}

- name: Store app artifacts
if: ${{ github.event.inputs.mode == 'all' }}
if: ${{ always() && github.event.inputs.mode == 'all' }}
uses: actions/upload-artifact@v4
with:
name: app
Expand All @@ -111,17 +118,106 @@ jobs:
app/build/outputs/apk/debug/app-debug.apk

- name: Store batch app artifacts
if: ${{ github.event.inputs.mode == 'batch' }}
if: ${{ always() && github.event.inputs.mode == 'batch' }}
uses: actions/upload-artifact@v4
with:
name: batch-app-artifacts
path: |
batch_artifacts

- name: Store batch summary
if: ${{ github.event.inputs.mode }} == 'batch'
if: ${{ always() && github.event.inputs.mode == 'batch' }}
uses: actions/upload-artifact@v4
with:
name: batch-summary
path: |
release_update_batch_summary.json

push_batch_build:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
env:
GITHUB_ACCESS_KEY: ${{ secrets.GH_ACCESS_KEY }}
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
API_ACCESS_KEY: ${{ secrets.API_ACCESS_KEY }}

steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Validate secrets
run: |
if [ -z "$(echo "$API_ACCESS_KEY" | tr -d '[:space:]')" ]; then
echo "ERROR: API_ACCESS_KEY is not available."
exit 1
fi
if [ -z "$(echo "$GITHUB_USERNAME" | tr -d '[:space:]')" ]; then
echo "ERROR: GITHUB_USERNAME is not available (required for GitHub Packages Maven auth)."
exit 1
fi
if [ -z "$(echo "$GITHUB_ACCESS_KEY" | tr -d '[:space:]')" ]; then
echo "ERROR: GITHUB_ACCESS_KEY is not available (required for GitHub Packages Maven auth)."
exit 1
fi

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Caching Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Setup ruby and fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Cache Zoom SDK files
id: zoom-cache
uses: actions/cache@v3
with:
path: |
./mobilertc
./commonlib
key: zoom_sdk_files

- name: Setup Zoom SDK
if: steps.zoom-cache.outputs.cache-hit != 'true'
run: |
wget https://media.testpress.in/static/android/zoom_sdk.zip
unzip -o ./zoom_sdk.zip

- name: Batch release (draft)
run: |
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
bundle exec fastlane release_update_batch subdomains:"lms,lmsdemo" release_option:draft

- name: Store push batch app artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: push-batch-app-artifacts
path: |
batch_artifacts

- name: Store push batch release summary
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: push-batch-release-summary
path: |
release_update_batch_summary.json
11 changes: 6 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ desc "Release updates for a comma-separated batch of subdomains (always continue
lane :release_update_batch do |params|
raw_subdomains = params[:subdomains].to_s
release_option = params[:release_option]
workspace_root = ENV["GITHUB_WORKSPACE"].to_s.strip.empty? ? Dir.pwd : ENV["GITHUB_WORKSPACE"].to_s

Choose a reason for hiding this comment

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

high

There's a potential bug here. If ENV["GITHUB_WORKSPACE"] contains leading/trailing whitespace, it is not stripped from the assigned value in the else case, which could lead to invalid paths. Additionally, ENV["GITHUB_WORKSPACE"].to_s is called twice. The suggestion fixes both issues by using an assignment within the expression to avoid repetition.

  workspace_root = (path = ENV["GITHUB_WORKSPACE"].to_s.strip).empty? ? Dir.pwd : path


subdomains = raw_subdomains
.split(/[,\s]+/)
Expand All @@ -32,9 +33,9 @@ lane :release_update_batch do |params|
skipped = []

expected_artifacts = [
{ "src" => File.join("app", "build", "outputs", "bundle", "release", "app-release.aab"), "dst" => "app-release.aab" },
{ "src" => File.join("app", "build", "outputs", "apk", "release", "app-release.apk"), "dst" => "app-release.apk" },
{ "src" => File.join("app", "build", "outputs", "apk", "debug", "app-debug.apk"), "dst" => "app-debug.apk" }
{ "src" => File.join(workspace_root, "app", "build", "outputs", "bundle", "release", "app-release.aab"), "dst" => "app-release.aab" },
{ "src" => File.join(workspace_root, "app", "build", "outputs", "apk", "release", "app-release.apk"), "dst" => "app-release.apk" },
{ "src" => File.join(workspace_root, "app", "build", "outputs", "apk", "debug", "app-debug.apk"), "dst" => "app-debug.apk" }
].freeze

subdomains.each do |subdomain|
Expand All @@ -60,7 +61,7 @@ lane :release_update_batch do |params|
generate_customized_app_files(app_config: app_config)

current_step = "collect_artifacts"
artifact_root = File.join("batch_artifacts", subdomain)
artifact_root = File.join(workspace_root, "batch_artifacts", subdomain)
FileUtils.mkdir_p(artifact_root)

missing = []
Expand Down Expand Up @@ -107,7 +108,7 @@ lane :release_update_batch do |params|
}
}

File.write("release_update_batch_summary.json", JSON.pretty_generate(summary))
File.write(File.join(workspace_root, "release_update_batch_summary.json"), JSON.pretty_generate(summary))

UI.message("Batch release summary: requested=#{subdomains.length}, succeeded=#{succeeded.length}, failed=#{failed.length}, skipped=#{skipped.length}")
if failed.any?
Expand Down
Loading