Skip to content

Latest commit

 

History

History
225 lines (180 loc) · 10.5 KB

RELEASE.md

File metadata and controls

225 lines (180 loc) · 10.5 KB

Releasing AgentTerm

Two things are released: the iPhone app, through TestFlight, and the Mac app, as a notarized disk image to download. The Mac app cannot go on the Mac App Store: it starts shells and other programs, which the App Sandbox the store requires does not allow.

Both run through scripts/release.sh, which reads the secrets from the private dotfiles repo and hands them to fastlane. Nothing secret is kept here.

scripts/release.sh --check        # which secrets and tools were found
scripts/release.sh ios build      # build the iPhone app signed for the App Store
scripts/release.sh ios beta       # ... and upload it to TestFlight
scripts/release.sh mac sign       # build AgentTerm.app, sign with Developer ID, make a .dmg
scripts/release.sh mac release    # ... and notarize it

The version of both apps is the one line of the VERSION file at the root of the repository; make bump V=0.3.0 changes it. VERSION=0.3.0-beta.1 in front of a command builds another one without changing the file. When the protocol version changes with it, add a row to the compatibility table in the README.

Released builds and development builds

A build made on your own machine is not the released app. scripts/run-mac.sh and a Debug build of the iPhone project produce AgentTerm Dev, an app of its own that can be installed next to the released one:

Released Development
Name AgentTerm AgentTerm Dev
Bundle identifier com.manhpham.agentterm com.manhpham.agentterm.dev
Data on the Mac ~/Library/Application Support/AgentTerm ~/Library/Application Support/AgentTerm Dev
Host port 7717 7718
Pairing links agentterm:// agentterm-dev://

So trying a change never touches the installed app's sessions or paired devices. Either app understands the other's pairing links. The release lanes build the released app (CHANNEL=release for the Mac, the Release configuration for the iPhone); nothing else does.

What it needs

  • Xcode, brew install fastlane xcodegen.
  • In the dotfiles repo, projects/agentterm/release.env naming the Apple account, and under accounts/apple/<TEAM_ID>/:
    • apple.env with APPLE_TEAM_ID, ASC_KEY_ID, ASC_ISSUER_ID, MATCH_GIT_URL, MATCH_PASSWORD, and DEVELOPER_ID_P12_PASSWORD if the certificate has one;
    • AuthKey_<KEYID>.p8, the App Store Connect API key;
    • certs/developer_id_application.p12, the Developer ID certificate.

iPhone

The bundle identifier is com.manhpham.agentterm. Before the first upload:

  1. The identifier is registered in Certificates, Identifiers & Profiles.
  2. The app exists in App Store Connect with that identifier. fastlane cannot create it with an API key; it is made by hand, once.
  3. match holds an App Store provisioning profile for it. The first time, scripts/release.sh ios build create:true lets match make it and store it in the match repository. After that the lanes only read it.

ios beta gives the build the next number after the newest one TestFlight has for the version.

Who gets the build: the internal testers always. TESTFLIGHT_GROUPS=External (any group names, separated by commas) also gives it to those groups; for a group of outside testers the lane submits the build to Apple's beta review, and they get it when that passes. The release workflow does this for the External group unless its testflight_groups input is emptied. scripts/release.sh ios groups lists the groups, and TESTFLIGHT_GROUPS=External scripts/release.sh ios distribute gives a build that is already uploaded to them without building again.

The App Store listing

The listing is kept as text files in fastlane/metadata: the name, subtitle, description, keywords, promotional text and the three URLs under en-US/, the categories and copyright next to it, and the contact and notes for App Review under review_information/. Apple's limits: 30 characters for the name and the subtitle, 100 for the keywords, 170 for the promotional text, 4000 for the description.

make store-metadata      # send the listing; "What's New" is the version's release notes
make store-screenshots   # send fastlane/screenshots/en-US

That folder holds the iPhone's pictures (1260 x 2736) and the iPad's (ipad-*.png, 2064 x 2752, #88); fastlane tells them apart by their size and sends each to its device's place in the listing.

The "Store listing" workflow on GitHub does the same from CI, run by hand (gh workflow run metadata.yml, with -f screenshots=true for the screenshots too). Neither submits anything for review. App Store Connect takes the contact for App Review only together with a phone number, which is in review_information/phone_number.txt.

Mac

mac sign builds a release AgentTerm.app, signs the daemon and then the app with the Developer ID certificate, with the hardened runtime and a timestamp, and puts the app in dist/AgentTerm-<version>.dmg, next to a shortcut to Applications to drag it onto. The certificate is imported into a keychain of its own for the run and that keychain is deleted afterwards.

mac release then sends the disk image to Apple's notary service, waits for the verdict, staples the ticket to it and checks it with spctl.

The app is built for the Mac it is built on (Apple silicon on an Apple silicon Mac). There is no universal build yet.

Before a release

  • VERSION holds the version being released. A release as 0.3.0-beta.1 is a pre-release of 0.3.0; the workflow refuses a version that is not the one in the file (scripts/check-version.sh).

  • packaging/release-notes/ holds what is said about a release:

    • v0.3.0.md says what changed in the version. The workflow refuses to release without it (scripts/check-release-notes.sh).
    • v0.3.0-beta.4.md, when there is one, is used for that pre-release instead: what is new since the one before.
    • Either can have a file next to it ending in .testflight.md (v0.3.0-beta.4.testflight.md). TestFlight shows that one as "What to Test": what changed on the iPhone and what testers should try. Without it TestFlight gets the release notes.

    The GitHub release and the Discord announcement show the release notes. For TestFlight the iPhone lane waits until Apple has processed the build; NOTES=0 skips the waiting and the notes.

  • The pictures show the apps as they are released: scripts/screenshots.sh takes them again (see TESTING.md), on the iPhone and the iPad, and make store-screenshots sends both to App Store Connect. An app that runs on the iPad is not taken without the iPad's.

  • The tests have been run, all of them, as TESTING.md says under "Running them".

make release V=0.3.0-beta.1 runs both checks and then starts the workflow.

Usage statistics and crash reports

Released builds report through Firebase, within what the user allows (see the privacy policy, https://bitfaring.com/products/agentterm/privacy/). There is one Firebase project for each app, because both have the same bundle identifier. Their config files are in the dotfiles repo, at projects/agentterm/firebase/{mac,ios}/GoogleService-Info.plist:

  • scripts/release.sh hands them to the lanes as FIREBASE_CONFIG_MAC and FIREBASE_CONFIG_IOS; the workflow gets them from secrets of the same names (scripts/sync-agentterm.sh in dotfiles sets them).
  • bundle-mac.sh copies the Mac's into a release bundle; the iPhone lane copies the other into the project for the build.
  • Without a file the app is built with no service and reports nothing. That is what a build from source is, and a development build never uses one.

Crashlytics is not given debug symbols yet, so stack traces in its console show addresses, not function names.

Discord

After a release the workflow posts the version's release notes in a Discord channel, with links to the GitHub release and TestFlight, through a webhook of that channel. The webhook's address is the DISCORD_WEBHOOK_URL secret, kept in the dotfiles repo's projects/agentterm/release.env; without it nothing is posted. scripts/announce-discord.sh <version> does the same by hand, and DRY_RUN=1 prints the message without sending it. To have the workflow announce a release that is already out, start it with both apps switched off: gh workflow run release.yml -f version=<version> -f mac=false -f ios=false.

Homebrew

The Mac app also installs with

brew tap bitfaring/tap
brew trust bitfaring/tap     # Homebrew 7 and later: a tap outside Homebrew's own has to be trusted first
brew install --cask agentterm

The cask lives in the tap repository, Bitfaring/homebrew-tap, and is written from the template packaging/homebrew/agentterm.rb. scripts/publish-homebrew.sh <version> fills in the version and the checksum published with that version's GitHub release (AgentTerm-<version>.sha256), the one brew checks the download against, and pushes it to the tap; a dist/AgentTerm-<version>.dmg that is there and is not that image is refused, never hashed in its place (#316). The release workflow runs it after publishing the disk image, when the HOMEBREW_TAP_TOKEN secret is set. By hand it uses git's sign-in on your machine; DRY_RUN=1 prints the cask and pushes nothing. Beta versions are published to the tap too.

From GitHub Actions

.github/workflows/release.yml runs the same lanes on GitHub's runners. Pushing a tag such as v0.2.0 releases both apps: the Mac disk image goes on a GitHub release of that tag with its checksum, the iPhone app goes to TestFlight. A version with a suffix (v0.2.0-beta.1) makes the GitHub release a prerelease. The workflow can also be run by hand with a version, for one of the two apps or both. A version typed there is given to the scripts through the environment and must look like 0.15.1 or 0.15.1-beta.1, or the run stops in its first step (#318). The release's tag is put on the commit that was built, also when the run was started by hand from a branch (target_commitish, #315).

The actions that are not GitHub's own (maxim-lobanov/setup-xcode, softprops/action-gh-release) are pinned by commit, with their tag beside it in a comment; Dependabot proposes their updates as for any action. The signing files are removed as soon as the apps are signed and notarized, before the release is published, and again at the end whatever happened (#314).

Its secrets are set from the dotfiles repo, which shows what it would set before setting anything:

scripts/sync-agentterm.sh            # in the dotfiles repo: dry run
scripts/sync-agentterm.sh --apply

.github/workflows/ci.yml builds the package and runs its tests on every push and pull request.