These are configured once (not per project).
Install Flutter and Android Studio, if you haven't done it yet.
Make sure you have installed:
sudo apt-get install curl sed git ruby python3 python-is-python3 pipx uuidgen openjdk-17-jdk
Make sure you have correctly set JAVA_HOME
:
# ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
Fastlane is a command-line tool written in Ruby that automates common tasks in iOS and Android development workflows, such as building, testing, code signing, and deploying apps to the App Store and Play Store.
Make sure your Ruby gems live in your local user space to avoid unexpected file permission issues:
# ~/.bash_profile
export GEM_HOME="$HOME/.gems"
export PATH="$HOME/.gems/bin:$PATH"
Then install Fastlane
gem install bundler fastlane
Install GitHub CLI.
Login and add permissions:
gh auth login
gh auth refresh -h github.com -s delete_repo -s admin:public_key
Create personal authentication key:
ssh-keygen -t ed25519 -P "" -C "$(gh api user --jq '.login')"
gh ssh-key add $HOME/.ssh/id_ed25519.pub --title 'Personal'
Slack is used for CI/CD notifications. Create an account and install Slack application:
sudo snap install slack
Create #cicd-all
public channel.
Assuming Apple Developer Program membership is active.
Create and download App Store Connect API (team) key for CI/CD integration. Use App Manager role (or Admin if feeling lucky). Take note of the Issuer ID and the Key ID.
Set env variables:
# ~/.bashrc
# codemagic cli
export APP_STORE_CONNECT_ISSUER_ID=
export APP_STORE_CONNECT_KEY_IDENTIFIER=
export APP_STORE_CONNECT_PRIVATE_KEY_PATH=
# fastlane cli
# export APP_STORE_CONNECT_API_KEY_PATH="$HOME/.secrets/apple/fastlane-api-key.json"
# echo '{
# "key_id": "'"$APP_STORE_CONNECT_KEY_IDENTIFIER"'",
# "issuer_id": "'"$APP_STORE_CONNECT_ISSUER_ID"'",
# "key": "'$(cat "$APP_STORE_CONNECT_PRIVATE_KEY_PATH" | base64 -w0)'",
# "is_key_content_base64": true,
# "in_house": false
# }' > "$APP_STORE_CONNECT_API_KEY_PATH"
Go to your account setting and enable Slack integration.
Save Codemagic API token to $HOME/.secrets/codemagic/auth-token
and add env variable:
# ~/.bashrc
export CM_API_TOKEN_PATH="$HOME/.secrets/codemagic/auth-token"
Create and submit SSH authentication key for accessing GitHub private repositories from Codemagic:
mkdir -p $HOME/.secrets/codemagic
openssl rand -base64 16 > $HOME/.secrets/codemagic/github_id_ed25519.pass
ssh-keygen -t ed25519 -f $HOME/.secrets/codemagic/github_id_ed25519 \
-P "$(cat $HOME/.secrets/codemagic/github_id_ed25519.pass)" \
-C "$(gh api user --jq '.login')"
gh ssh-key add $HOME/.secrets/codemagic/github_id_ed25519.pub --title 'Codemagic'
You can find existing keys here.
Create env variables:
# ~/.bashrc
export CM_GITHUB_SSH_KEY_PATH="$HOME/.secrets/codemagic/github_id_ed25519"
export CM_GITHUB_SSH_KEY_PASS="$(cat "$HOME/.secrets/codemagic/github_id_ed25519.pass")"
Install Codemagic CLI suite:
pipx install codemagic-cli-tools
pipx ensurepath
Register with Sentry.
Create two auth tokens in User Auth Tokens,
and save them in $HOME/.secrets/sentry
directory:
api-token-projects
: Projects: Admin; Organisation: Read (used locally for initial project setup)api-token-ci
: Release: Admin; Organisation: Read (used locally and on CI server)
Add variables:
# ~/.bashrc
export SENTRY_PROJECTS_ADMIN_TOKEN_PATH="$HOME/.secrets/sentry/api-token-projects"
export SENTRY_CI_TOKEN_PATH="$HOME/.secrets/sentry/api-token-ci"
export SENTRY_ORG="{organization-id-or-slug}"
export SENTRY_TEAM="{default-team-id-or-slug}"
Create a billing account if you don't have a suitable one.
Place your fallback billing account to GCLOUD_BILLING_ACCOUNT_ID
for the project setup script.
Then follow official gcloud
CLI installation instructions.
Shorebird is a tool that can patch production apps without going through the app store review process.
Create a dev account with Shorebird.
Here are some aliases you may find useful.
# ~/.bashrc
alias ba='dart run build_runner build && git add -A .'
alias fa='flutter pub add '
alias ft='flutter test -x screenshots '
alias fscreens='flutter test --update-goldens --tags=screenshots'
alias fit='flutter drive --driver=test_driver/integration_test.dart --target=integration_test/all_tests.dart'
alias frl='flutter run -d "linux"'
Personal:
# ~/.bashrc
alias frm='flutter run -d "moto g24"'