From f06af91b447eaa8a9992fcd9411e625e18ddf857 Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Mon, 14 Dec 2020 12:38:00 -0800 Subject: [PATCH] Redo the GitHub actions for TestFlight Now makes different builds for App Store and sideloading, where the App Store build is 13gb and the sideloading build is not. Uploads all builds and dSYMs to GitHub releases, except the App Store ipa because it's 13gb. Release is marked "prerelease", so it doesn't actually go out to AltStore until it's edited to be not prerelease. TestFlight build is also not distributed externally (though the changelog is updated). Almost completely untested. Let's see how it goes! --- .github/workflows/beta.yml | 16 ++++++- app/AppStore.xcconfig | 1 + deps/aports/download-repos.py | 2 +- fastlane/Fastfile | 87 +++++++++++++++++++---------------- fastlane/README.md | 11 +++-- 5 files changed, 72 insertions(+), 45 deletions(-) create mode 100644 app/AppStore.xcconfig diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 33d77b6668..2089c85ac1 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -1,4 +1,4 @@ -name: TestFlight Beta +name: TestFlight Build on: workflow_dispatch: @@ -10,6 +10,7 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Install deps run: | pip3 install meson @@ -17,8 +18,11 @@ jobs: bundle install git config --global user.name iSH git config --global user.email 74480058+ish-actions@users.noreply.github.com + cd deps/aports + ./download-repos.py + - name: Fastlane - run: bundle exec fastlane beta + run: bundle exec fastlane upload_build env: APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} @@ -28,3 +32,11 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} SLACK_URL: ${{ secrets.SLACK_URL }} FASTLANE_SKIP_UPDATE_CHECK: 1 + + - uses: actions/upload-artifact@v2 + with: + name: App + path: | + iSH.ipa + iSH.app.dSYM.zip + iSH-appstore.app.dSYM.zip diff --git a/app/AppStore.xcconfig b/app/AppStore.xcconfig new file mode 100644 index 0000000000..5f60adb2a0 --- /dev/null +++ b/app/AppStore.xcconfig @@ -0,0 +1 @@ +ENABLE_APK_ODRS = YES diff --git a/deps/aports/download-repos.py b/deps/aports/download-repos.py index 5ee718a1b9..d3b55d5e86 100755 --- a/deps/aports/download-repos.py +++ b/deps/aports/download-repos.py @@ -6,7 +6,7 @@ import pathlib import concurrent.futures -socket.setdefaulttimeout(5) +socket.setdefaulttimeout(10) IX_NAME = 'P' IX_VERSION = 'V' diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 40cee665dc..d0db8892c8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -1,67 +1,76 @@ -lane :beta do - app_store_connect_api_key +before_all do + ensure_bundle_exec +end + +lane :build do |options| setup_ci sync_code_signing sync_code_signing(type: 'appstore') - changelog = File.read('changelog.txt') - last_tag = `git describe --tags --abbrev=0 --match builds/\*`.chomp - testflight_changelog = changelog + "\n" + File.read("footer.txt") + `git shortlog #{last_tag}..HEAD` - - latest = latest_testflight_build_number.to_s.scan(/^\d+(?=\.|$)/).first.to_i - build_number = latest + 1 - increment_build_number(build_number: build_number) - commit_version_bump( - xcodeproj: 'iSH.xcodeproj', - message: "Release build #{build_number} to testflight", - include: "fastlane/changelog.txt", - force: true, - ) - tag = "builds/#{build_number}" - add_git_tag(tag: tag) - # do this after commiting the version bump but before building the app if is_ci update_code_signing_settings( - path: 'iSH.xcodeproj', - targets: 'iSH', + path: "iSH.xcodeproj", + targets: "iSH", use_automatic_signing: false, - profile_uuid: ENV['sigh_app.ish.iSH_development'], + profile_uuid: ENV["sigh_app.ish.iSH_development"], ) update_code_signing_settings( - path: 'iSH.xcodeproj', - targets: 'iSHFileProvider', + path: "iSH.xcodeproj", + targets: "iSHFileProvider", use_automatic_signing: false, - profile_uuid: ENV['sigh_app.ish.iSH.FileProvider_development'], + profile_uuid: ENV["sigh_app.ish.iSH.FileProvider_development"], ) end + config = options[:config] + config = "app/#{config}.xcconfig" if config build_app( - project: 'iSH.xcodeproj', - scheme: 'iSH', + project: "iSH.xcodeproj", + scheme: "iSH", + xcconfig: config, + output_name: options[:output], + ) +end + +lane :upload_build do + app_store_connect_api_key + + changelog = File.read("changelog.txt") + last_tag = `git describe --tags --abbrev=0 --match builds/\*`.chomp + shortlog = `git shortlog #{last_tag}..HEAD` + testflight_changelog = changelog + "\n" + File.read("footer.txt") + shortlog + + latest = latest_testflight_build_number.to_s.scan(/^\d+(?=\.|$)/).first.to_i + build_number = latest + 1 + Dir.chdir("..") do + sh "agvtool", "new-version", build_number.to_s + end + commit_version_bump( + xcodeproj: "iSH.xcodeproj", + message: "Bump version to #{build_number}", + force: true, ) + tag = "builds/#{build_number}" + add_git_tag(tag: tag) + + build + build(config: "AppStore", output: "iSH-appstore") + puts testflight_changelog upload_to_testflight( + ipa: "iSH-appstore.ipa", changelog: testflight_changelog, - distribute_external: true, - groups: ["People"] ) push_to_git_remote set_github_release( - repository_name: 'ish-app/ish', + repository_name: "ish-app/ish", tag_name: tag, commitish: nil, # the tag better exist name: "Build #{build_number}", description: changelog, - upload_assets: ['iSH.ipa'], - api_token: ENV['GH_TOKEN'], + is_prerelease: true, + upload_assets: ["iSH.ipa", "iSH.app.dSYM.zip", "iSH-appstore.app.dSYM.zip"], + api_token: ENV["GH_TOKEN"], ) - slack( - message: "New build available!", - default_payloads: [], - payload: { - "Changelog" => changelog - }, - use_webhook_configured_username_and_icon: true, - ) end diff --git a/fastlane/README.md b/fastlane/README.md index e06279e858..192eb769a9 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -12,12 +12,17 @@ Install _fastlane_ using ``` [sudo] gem install fastlane -NV ``` -or alternatively using `brew cask install fastlane` +or alternatively using `brew install fastlane` # Available Actions -### beta +### build ``` -fastlane beta +fastlane build +``` + +### upload_build +``` +fastlane upload_build ```