Skip to content

Commit

Permalink
Redo the GitHub actions for TestFlight
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
tbodt committed Dec 14, 2020
1 parent 698fa65 commit f06af91
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 45 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TestFlight Beta
name: TestFlight Build

on:
workflow_dispatch:
Expand All @@ -10,15 +10,19 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true

- name: Install deps
run: |
pip3 install meson
brew install ninja
bundle install
git config --global user.name iSH
git config --global user.email [email protected]
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 }}
Expand All @@ -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
1 change: 1 addition & 0 deletions app/AppStore.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENABLE_APK_ODRS = YES
2 changes: 1 addition & 1 deletion deps/aports/download-repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pathlib
import concurrent.futures

socket.setdefaulttimeout(5)
socket.setdefaulttimeout(10)

IX_NAME = 'P'
IX_VERSION = 'V'
Expand Down
87 changes: 48 additions & 39 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 8 additions & 3 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```


Expand Down

0 comments on commit f06af91

Please sign in to comment.