Skip to content

Commit

Permalink
ci: add option to distribute to external testflight groups (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
netbe authored May 24, 2024
1 parent 1003ca0 commit 22d75d3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/_reusable_app_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
skip_security_tests:
type: boolean
default: true
distribute_externals:
type: boolean
default: false

secrets:
KEYCHAIN_PASSWORD:
required: true
Expand Down Expand Up @@ -60,6 +64,10 @@ on:
required: true
C3_APP_CENTER_APP_NAME_PRODUCTION:
required: true
PLAYGROUND_TESTFLIGHT_LINK:
required: true
BETA_TESTFLIGHT_LINK:
required: true
SUBMODULE_PAT:
required: true

Expand Down Expand Up @@ -107,8 +115,12 @@ jobs:
C3_APP_CENTER_APP_NAME_RESTRICTED: ${{ secrets.C3_APP_CENTER_APP_NAME_RESTRICTED }}
C3_S3_SUBFOLDER_PRODUCTION: ${{ secrets.C3_S3_SUBFOLDER_PRODUCTION }}
C3_APP_CENTER_APP_NAME_PRODUCTION: ${{ secrets.C3_APP_CENTER_APP_NAME_PRODUCTION }}
BETA_TESTFLIGHT_LINK: ${{ secrets.BETA_TESTFLIGHT_LINK }}
PLAYGROUND_TESTFLIGHT_LINK: ${{ secrets.PLAYGROUND_TESTFLIGHT_LINK }}
SLACK_WEBHOOK_URL: ${{ secrets.WIRE_IOS_CI_WEBHOOK }}
SKIP_SECURITY_TESTS: ${{ inputs.skip_security_tests }}
SEND_TO_EXTERNALS: ${{ inputs.distribute_externals }}


steps:
- name: Add Masks
Expand Down Expand Up @@ -187,7 +199,7 @@ jobs:
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "**${{ env.APP_NAME }}** (version: ${{ env.BUILD_VERSION }} build: ${{ env.BUILD_NUMBER }}) is ready to test 🚀\n**DATADOG_ENABLED:** ${{ env.ENABLE_DATADOG }}\n**CHANGELOG:** ${{ needs.changelog.outputs.changelog-url }}\n**Tap on iOS device to install:** ${{ env.APPCENTER_INSTALL_LINK }}\n**AWS S3 Paths:**\n`${{ steps.base64-decoded-S3_PATHS.outputs.decoded }}`\n**Triggered by:** ${{ github.triggering_actor }}\n**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n"
text: "**${{ env.APP_NAME }}** (version: ${{ env.BUILD_VERSION }} build: ${{ env.BUILD_NUMBER }}) is ready to test 🚀\n**DATADOG_ENABLED:** ${{ env.ENABLE_DATADOG }}\n**CHANGELOG:** ${{ needs.changelog.outputs.changelog-url }}\n**Tap on iOS device to install:** ${{ env.BUILD_INSTALL_LINK }}\n**AWS S3 Paths:**\n`${{ steps.base64-decoded-S3_PATHS.outputs.decoded }}`\n**Triggered by:** ${{ github.triggering_actor }}\n**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n"
- name: Notify on Wire if failed
if: failure()
uses: 8398a7/action-slack@v3
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/beta_app_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Beta

on: workflow_dispatch

on:
workflow_dispatch:
inputs:
distribute_externals:
type: boolean
description: 'Distribute externally'
default: false
permissions:
checks: write

Expand All @@ -10,4 +15,5 @@ jobs:
uses: ./.github/workflows/_reusable_app_release.yml
with:
fastlane_action: testflight_beta
distribute_externals: ${{ inputs.distribute_externals }}
secrets: inherit
9 changes: 8 additions & 1 deletion .github/workflows/playground.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Playground

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
distribute_externals:
type: boolean
description: 'Distribute externally'
default: false

permissions:
checks: write
Expand All @@ -10,4 +16,5 @@ jobs:
uses: ./.github/workflows/_reusable_app_release.yml
with:
fastlane_action: playground
distribute_externals: ${{ inputs.distribute_externals }}
secrets: inherit
20 changes: 16 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ platform :ios do
options[:build_type] = "Playground"
options[:upload_testflight] = true
options[:upload_dsyms_to_datadog] = true
options[:extra_distribution_groups] = ["Wire Employees", "Externals - Non Wire Employees"]
options[:produce_debug_builds] = true
save_app_name('Playground')
build_and_upload_app(options)
`export TEMP='APPCENTER_INSTALL_LINK=For \'Playground\' build there is no AppCenter link, please visit Testflight to install the app' && echo $TEMP >> ./.post_build/.env`
`export TEMP='BUILD_INSTALL_LINK=#{ENV['BETA_TESTFLIGHT_LINK']}' && echo $TEMP >> ./.post_build/.env`
end

desc "Build & Upload Testflight Beta build"
Expand All @@ -86,9 +87,10 @@ platform :ios do
options[:upload_testflight] = true
options[:upload_dsyms_to_datadog] = true
options[:produce_debug_builds] = true
options[:extra_distribution_groups] = ["Wire Employees", "Externals - Non Wire Employees"]
save_app_name('Testflight Beta')
build_and_upload_app(options)
`export TEMP='APPCENTER_INSTALL_LINK=For \'Beta\' build there is no AppCenter link, please visit Testflight to install the app' && echo $TEMP >> ./.post_build/.env`
`export TEMP='BUILD_INSTALL_LINK=#{ENV['PLAYGROUND_TESTFLIGHT_LINK']}' && echo $TEMP >> ./.post_build/.env`
end

desc "Build & Upload Public AppStore build"
Expand Down Expand Up @@ -398,13 +400,20 @@ platform :ios do
def upload_testflight(options)
build = Build.new(options: options)
sh "cp ../wire-ios/Configuration/Appfile ."

# we add this group to get a review from Apple when we upload new build version
# in order to speed up distribution to real external groups
groups = ["Default External Testers"]
if build.send_to_externals
groups += options[:extra_distribution_groups]
end

upload_to_testflight(
api_key_path: appstoreconnect_api_key_file_path,
ipa: "#{build.artifact_path(with_filename: true)}.ipa",
skip_waiting_for_build_processing: false,
distribute_external: true,
groups: ["Default External Testers", "Externals - Non Wire Employees"],
groups: groups,
submit_beta_review: true,
changelog: changelog(build)
)
Expand Down Expand Up @@ -457,7 +466,7 @@ platform :ios do
)

appcenter_build_info = Fastlane::Actions.lane_context[:APPCENTER_BUILD_INFORMATION]
`export TEMP='APPCENTER_INSTALL_LINK=#{appcenter_build_info['install_url']}' && echo $TEMP >> ./.post_build/.env`
`export TEMP='BUILD_INSTALL_LINK=#{appcenter_build_info['install_url']}' && echo $TEMP >> ./.post_build/.env`
end

# Upload to S3 (Automation builds)
Expand Down Expand Up @@ -530,6 +539,8 @@ class Build
attr_reader :configuration
attr_reader :enable_datadog
attr_reader :skip_security_tests
# send to non-default external distribution list
attr_reader :send_to_externals

def initialize(options:)
build_number = options[:build_number]
Expand All @@ -549,6 +560,7 @@ class Build
@git_branch = ENV['GITHUB_REF_NAME']
end

@send_to_externals = ENV['SEND_TO_EXTERNALS'] == "true" || ENV['SEND_TO_EXTERNALS'] == "1"
@enable_datadog = ENV['ENABLE_DATADOG'] == "true" || ENV['ENABLE_DATADOG'] == "1"
@skip_security_tests = ENV['SKIP_SECURITY_TESTS'] == "true" || ENV['SKIP_SECURITY_TESTS'] == "1"
@build_number = build_number
Expand Down

0 comments on commit 22d75d3

Please sign in to comment.