Skip to content

Commit

Permalink
Fastlane deploy test (#2906)
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto-titan authored Nov 19, 2023
2 parents 47b5f6a + 88d1633 commit 3b68e49
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 8 deletions.
131 changes: 131 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
on:
push:
branches:
- "release/**"

jobs:
build:
runs-on: macos-13
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install Android Tools
run: |
which sdkmanager
sdkmanager "tools"
sdkmanager --update
sdkmanager "build-tools;33.0.0" "platform-tools" "platforms;android-33" "tools"
echo "y" | sdkmanager --licenses
sdkmanager --install "ndk;23.1.7779620"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: ruby/setup-ruby@v1
with:
working-directory: 'apps/wallet-mobile'
ruby-version: '3.1.0'
bundler-cache: true

- uses: maierj/[email protected]
with:
subdirectory: 'apps/wallet-mobile'
lane: 'bump_build_android'

- uses: maierj/[email protected]
with:
subdirectory: 'apps/wallet-mobile'
lane: 'bump_build_ios'


- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: ci-bot
author_email: [email protected]
message: 'chore(release): nightly'
add: '.'

- name: Install deps for ASDF
run: brew install coreutils curl git

- name: Install ASDF
run: brew install asdf

- name: Install ASDF packages
run: |
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> $HOME/.zshrc
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> $HOME/.bashrc
. /usr/local/opt/asdf/libexec/asdf.sh
cd apps/wallet-mobile
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf plugin-add java https://github.com/halcyon/asdf-java.git
asdf plugin-add rust https://github.com/code-lever/asdf-rust.git
asdf plugin-add python
asdf install
asdf install python 2.7.13
rustup default 1.69
rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim aarch64-linux-android armv7-linux-androideabi i686-linux-android wasm32-unknown-unknown x86_64-apple-ios x86_64-linux-android
bash -c -l "rustup default 1.69"
bash -l -c "rustup target add aarch64-apple-darwin aarch64-apple-ios aarch64-apple-ios-sim aarch64-linux-android armv7-linux-androideabi i686-linux-android wasm32-unknown-unknown x86_64-apple-ios x86_64-linux-android"
gem install cocoapods fastlane
ruby --version
python --version
node --version
rustc --version
java --version
cargo install --version 3.1.1 cargo-lipo
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Yarn & Pod Install
run: |
. /usr/local/opt/asdf/libexec/asdf.sh
yarn install
cd apps/wallet-mobile
yarn install
cd ios
pod install
cd ..
yarn workspaces run build
- name: Copy Apple Signing Key
run: |
mkdir -p $HOME/.yoroi/ios
echo ${{secrets.APP_STORE_KEY}} | base64 -d > $HOME/.yoroi/ios/AuthKey_PH9Z89M567.p8
chmod 600 $HOME/.yoroi/ios/AuthKey_PH9Z89M567.p8
- name: Copy Android Keys
run: |
mkdir -p $HOME/.yoroi/android
echo ${{secrets.ANDROID_NIGHTLY_KEYSTORE}} | base64 -d > $HOME/.yoroi/android/nightly.keystore
chmod 600 $HOME/.yoroi/android/nightly.keystore
echo ${{secrets.ANDROID_KEYSTORE_PASS}} > $HOME/.yoroi/android/nightly.pass
echo ${{secrets.ANDROID_SERVICE_ACCOUNT_JSON}} | base64 -d > $HOME/.yoroi/android/service-account.json
- name: Copy Yoroi Certs SSH Key
run: |
mkdir -p $HOME/.ssh
echo ${{secrets.CERT_SSH_KEY}} | base64 -d > $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa
- name: Fastlane Deploy iOS and Android Nightly
run: |
. /usr/local/opt/asdf/libexec/asdf.sh
cd apps/wallet-mobile
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$HOME/Library/Android/sdk
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_KEYSTORE_PASS="${{secrets.ANDROID_KEYSTORE_PASS}}"
export ANDROID_KEY_PASS="${{secrets.ANDROID_KEY_PASS}}"
export CI_KEYCHAIN_NAME="${{secrets.CI_KEYCHAIN_NAME}}"
export CI_KEYCHAIN_PASSWORD="${{secrets.CI_KEYCHAIN_PASSWORD}}"
export FASTLANE_PASSWORD="${{secrets.FASTLANE_PASSWORD}}"
export MATCH_PASSWORD="${{secrets.MATCH_PASSWORD}}"
fastlane ios release --env nightly
asdf global python 2.7.13
fastlane android release --env nightly
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 16.19.0
rust 1.69.0
java adoptopenjdk-11.0.18+10
ruby 2.7.6
python 3.11.3
ruby 3.2.2
python 3.11.3
4 changes: 2 additions & 2 deletions apps/wallet-mobile/.tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 16.19.0
rust 1.69.0
java adoptopenjdk-11.0.18+10
ruby 2.7.6
python 3.11.3
ruby 3.2.2
python 3.11.3
36 changes: 32 additions & 4 deletions apps/wallet-mobile/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ platform :ios do
environment = lane_context[SharedValues::ENVIRONMENT]
scheme = environment == "nightly" ? "nightly" : "yoroi"

match(app_identifier: ENV["APP_STORE_BUNDLE_ID"], type: "appstore")
create_keychain(
name: ENV["CI_KEYCHAIN_NAME"],
password: ENV["CI_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: false
)

api_key = app_store_connect_api_key(
key_id: ENV["APP_STORE_KEY_ID"],
Expand All @@ -32,7 +39,20 @@ platform :ios do
duration: 1200,
in_house: false
)


match(app_identifier: ENV["APP_STORE_BUNDLE_ID"], type: "appstore", api_key: api_key, keychain_name: ENV["CI_KEYCHAIN_NAME"], keychain_password: ENV["CI_KEYCHAIN_PASSWORD"])

set_version_ios
bump_build_ios

update_code_signing_settings(
use_automatic_signing: false,
path: XC_PROJECT,
code_sign_identity: "iPhone Distribution",
bundle_identifier: ENV["APP_STORE_BUNDLE_ID"],
profile_name: "match AppStore #{ENV["APP_STORE_BUNDLE_ID"]}"
)

begin
gym(
scheme: scheme,
Expand All @@ -44,18 +64,23 @@ platform :ios do
xcargs: `-UseNewBuildSystem=YES`,
output_directory: "./ios",
output_name: "yoroi.ipa",
sdk: "iphoneos",
export_options: {
method: "app-store",
signingStyle: "automatic"
signingStyle: "manual",
provisioningProfiles: {
ENV["APP_STORE_BUNDLE_ID"] => "match AppStore #{ENV["APP_STORE_BUNDLE_ID"]}"
}
},
)
rescue => e
xcode_log_path = '~/Library/Logs/gym/yoroi-yoroi.log'
xcode_log_path = "~/Library/Logs/gym/#{scheme}-#{scheme}.log"
p "iOS build failed -> #{xcode_log_path}"
sh "cat #{xcode_log_path}"

raise 'iOS build failed.'
end
enable_automatic_code_signing(path: XC_PROJECT)

if ENV['DRY_RUN'] == 'true'
UI.message("DRY RUN: Skipping upload to App Store")
Expand All @@ -77,6 +102,9 @@ platform :android do

gradle(task: "clean", project_dir: 'android/')

bump_build_android
set_version_android

gradle(
task: "assemble" + build_type,
build_type: "Release",
Expand Down

0 comments on commit 3b68e49

Please sign in to comment.