diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml new file mode 100644 index 0000000000..87c40fa8c2 --- /dev/null +++ b/.github/workflows/alpha.yml @@ -0,0 +1,103 @@ +name: Make TestFlight Alpha Build + +on: + workflow_dispatch: + branches: + - develop + - graeme/ios-nightly-builds # TODO: Remove this before merging + #- '!develop' # filter out PRs matching that pattern + inputs: + destination: + description: "TestFlight Group" + required: true + default: "Latest Alpha Group" + type: string + + push: + branches: [ graeme/ios-nightly-builds ] + +jobs: + make-alpha: + if: github.event.action == 0 || github.event.pull_request.merged == true # empty string returns 0; for case when workflow is triggered manually + runs-on: macos-13 + name: Make TestFlight Alpha Build + + steps: + + - name: Set destination output + id: destination + run: | + INPUT_DESTINATION=${{ github.event.inputs.destination }} + echo "destination=${INPUT_DESTINATION}" >> $GITHUB_OUTPUT + + # - name: Assert develop branch TODO: Uncomment before merging + # run: | + # case "${{ github.ref }}" in + # *develop/*) ;; + # *) echo "👎 Not develop branch"; exit 1 ;; + # esac + + - name: Register SSH keys for access to certificates + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_FASTLANE_MATCH }} + + - name: Check out the code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set cache key hash + run: | + has_only_tags=$(jq '[ .object.pins[].state | has("version") ] | all' DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved) + if [[ "$has_only_tags" == "true" ]]; then + echo "cache_key_hash=${{ hashFiles('DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}" >> $GITHUB_ENV + else + echo "Package.resolved contains dependencies specified by branch or commit, skipping cache." + fi + + - name: Cache SPM + if: env.cache_key_hash + uses: actions/cache@v3 + with: + path: DerivedData/SourcePackages + key: ${{ runner.os }}-spm-${{ env.cache_key_hash }} + restore-keys: | + ${{ runner.os }}-spm- + + - name: Select Xcode + run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer + + - name: Prepare fastlane + run: bundle install + + - name: Archive and upload the app + env: + APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} + APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} + APPLE_API_KEY_ISSUER: ${{ secrets.APPLE_API_KEY_ISSUER }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + run: | + app_version="$(cut -d ' ' -f 3 < Configuration/Version.xcconfig)" + FASTLANE_DISABLE_OUTPUT_FORMAT=true bundle exec fastlane release_alpha groups:"${{ steps.destination.outputs.destination }}" + build_version="cat DuckDuckGo.xcodeproj/project.pbxproj | grep -m1 'CURRENT_PROJ ECT_VERSION' | cut -d'=' -f2 | tr -d ';' | tr -d ' '" + echo "dsyms_path=${{ github.workspace }}/DuckDuckGo.app.dSYM.zip" >> $GITHUB_ENV + echo "app_version=${app_version}" >> $GITHUB_ENV + echo "build_version=${build_version}" >> $GITHUB_ENV + + - name: Upload dSYMs artifact + uses: actions/upload-artifact@v3 + with: + name: DuckDuckGo-Alpha-dSYM-${{ env.app_version }} + path: ${{ env.dsyms_path }} + + - name: Upload debug symbols to Asana + env: + ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }} + run: | + asana_dsyms_path="${{ github.workspace }}/DuckDuckGo-Alpha-${{ env.app_version }}(${{ env.app_version }})-dSYM.zip" + mv -f "${{ env.dsyms_path }}" "$asana_dsyms_path" + + curl -s "https://app.asana.com/0/0/1205344386326139/f/attachments" \ + -H "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \ + --form "file=@${asana_dsyms_path};type=application/zip" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ad5c8bec9d..6e5d77bf08 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -94,3 +94,8 @@ jobs: with: report_paths: unittests.xml + deploy-alpha: + name: Deploy Nightly Alpha Build + uses: ./.github/workflows/alpha.yml + with: + destination: "Nightly Alpha Group" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a23744c96..df737b9341 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,13 +4,13 @@ on: workflow_dispatch: inputs: destination: - description: "Upload destination (App Store or TestFlight)" + description: "Type of release (App Store or Beta)" required: true default: appstore type: choice options: - appstore - - testflight + - beta asana-task-url: description: "Asana release task URL" required: false diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a130d9919d..3e9cd26917 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -156,7 +156,7 @@ }, { "package": "TrackerRadarKit", - "repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit", + "repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit.git", "state": { "branch": null, "revision": "4684440d03304e7638a2c8086895367e90987463", diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo-Alpha.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo-Alpha.xcscheme new file mode 100644 index 0000000000..ab41c0e9a0 --- /dev/null +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/DuckDuckGo-Alpha.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/alphaExportOptions.plist b/alphaExportOptions.plist new file mode 100644 index 0000000000..9f949f40ac --- /dev/null +++ b/alphaExportOptions.plist @@ -0,0 +1,23 @@ + + + + + teamID + HKE973VLUW + method + app-store + provisioningProfiles + + com.duckduckgo.mobile.ios.alpha + match AppStore com.duckduckgo.mobile.ios.alpha + com.duckduckgo.mobile.ios.alpha.ShareExtension + match AppStore com.duckduckgo.mobile.ios.alpha.ShareExtension + com.duckduckgo.mobile.ios.alpha.OpenAction2 + match AppStore com.duckduckgo.mobile.ios.alpha.OpenAction2 + com.duckduckgo.mobile.ios.alpha.Widgets + match AppStore com.duckduckgo.mobile.ios.alpha.Widgets + com.duckduckgo.mobile.ios.alpha.NetworkExtension + match AppStore com.duckduckgo.mobile.ios.alpha.NetworkExtension + + + diff --git a/fastlane/Fastfile b/fastlane/Fastfile index be82b0b85f..d9ac47458d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,6 +18,7 @@ lane :sync_signing_adhoc do |options| do_sync_signing(options) end +desc 'Fetches and updates certificates and provisioning profiles for Alpha distribution' lane :sync_signing_alpha do |options| do_sync_signing(options) end @@ -88,11 +89,6 @@ lane :adhoc do |options| end end -desc 'Makes Alpha release build and uploads it to App Store Connect (TestFlight)' -lane :alpha do |options| -# TODO -end - desc 'Makes App Store release build and uploads it to App Store Connect' lane :release_appstore do |options| build_release(options) @@ -124,7 +120,7 @@ lane :upload_metadata do |options| end desc 'Makes App Store release build and uploads it to TestFlight' -lane :release_testflight do +lane :release_beta do build_release upload_to_testflight( @@ -132,6 +128,16 @@ lane :release_testflight do ) end +desc 'Makes Alpha release build and uploads it to TestFlight' +lane :release_alpha do |options| + build_alpha(options) + + upload_to_testflight( + api_key: get_api_key, + groups: options[:groups] + ) +end + desc 'Increment build number based on version in App Store Connect' lane :increment_build_number_for_version do |options| increment_build_number({ @@ -172,6 +178,18 @@ private_lane :build_release do |options| ) end +private_lane :build_alpha do |options| + sync_signing_alpha(options) + + build_app( + export_method: "app-store", + configuration: "Alpha", + scheme: "DuckDuckGo-Alpha", + export_options: "alphaExportOptions.plist", + derived_data_path: "DerivedData" + ) +end + private_lane :get_api_key do has_api_key = [ "APPLE_API_KEY_ID", @@ -209,7 +227,7 @@ private_lane :do_sync_signing do |options| sync_code_signing( api_key: get_api_key, username: get_username(options), - readonly: is_ci && !is_adhoc + readonly: is_ci && !is_adhoc ) end diff --git a/fastlane/Matchfile b/fastlane/Matchfile index de59777a19..400b1ffebc 100644 --- a/fastlane/Matchfile +++ b/fastlane/Matchfile @@ -19,11 +19,9 @@ for_lane :adhoc do end for_lane :sync_signing_alpha do - type "appstore" app_identifier ["com.duckduckgo.mobile.ios.alpha", "com.duckduckgo.mobile.ios.alpha.ShareExtension", "com.duckduckgo.mobile.ios.alpha.OpenAction2", "com.duckduckgo.mobile.ios.alpha.Widgets", "com.duckduckgo.mobile.ios.alpha.NetworkExtension"] end -for_lane :alpha do - type "appstore" +for_lane :release_alpha do app_identifier ["com.duckduckgo.mobile.ios.alpha", "com.duckduckgo.mobile.ios.alpha.ShareExtension", "com.duckduckgo.mobile.ios.alpha.OpenAction2", "com.duckduckgo.mobile.ios.alpha.Widgets", "com.duckduckgo.mobile.ios.alpha.NetworkExtension"] end diff --git a/fastlane/README.md b/fastlane/README.md index b0375dd0f9..6e4acf39fc 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -35,7 +35,7 @@ Fetches and updates certificates and provisioning profiles for Ad-Hoc distributi [bundle exec] fastlane sync_signing_alpha ``` - +Fetches and updates certificates and provisioning profiles for Alpha distribution ### adhoc @@ -45,14 +45,6 @@ Fetches and updates certificates and provisioning profiles for Ad-Hoc distributi Makes Ad-Hoc build with a specified name in a given directory -### alpha - -```sh -[bundle exec] fastlane alpha -``` - -Makes Alpha release build and uploads it to App Store Connect (TestFlight) - ### release_appstore ```sh @@ -69,14 +61,22 @@ Makes App Store release build and uploads it to App Store Connect Updates App Store metadata -### release_testflight +### release_beta ```sh -[bundle exec] fastlane release_testflight +[bundle exec] fastlane release_beta ``` Makes App Store release build and uploads it to TestFlight +### release_alpha + +```sh +[bundle exec] fastlane release_alpha +``` + +Makes Alpha release build and uploads it to TestFlight + ### increment_build_number_for_version ```sh