Skip to content

Commit 3882c55

Browse files
committed
[NO TICKETS] Add build workflow and fastfile to build and upload to testflight
1 parent bc7c901 commit 3882c55

File tree

4 files changed

+185
-0
lines changed

4 files changed

+185
-0
lines changed

.github/workflows/build-ios.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: iOS Build and upload to testflight
2+
3+
on:
4+
push:
5+
branches:
6+
- ios-fastlane-setup
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: macos-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version-file: "frontend/package.json"
22+
23+
- name: Setup Xcode
24+
uses: maxim-lobanov/setup-xcode@v1
25+
with:
26+
xcode-version: '16.2'
27+
28+
- name: Install Bundler
29+
run: gem install bundler
30+
31+
- name: Create .env file
32+
working-directory: frontend
33+
run: |
34+
echo "VITE_BUILD_DATE=1970-01-01
35+
VITE_BUILD_TIME=00:00:00
36+
VITE_BUILD_TS=1970-01-01T00:00:00+0000
37+
VITE_BUILD_COMMIT_SHA=test
38+
VITE_BUILD_ENV_CODE=test
39+
VITE_BUILD_WORKFLOW_RUNNER=test
40+
VITE_BUILD_WORKFLOW_NAME=test
41+
VITE_BUILD_WORKFLOW_RUN_NUMBER=1
42+
VITE_BUILD_WORKFLOW_RUN_ATTEMPT=1
43+
VITE_BASE_URL_API=https://jsonplaceholder.typicode.com
44+
VITE_TOAST_AUTO_DISMISS_MILLIS=1500" > .env
45+
46+
- name: Install dependencies
47+
working-directory: frontend
48+
run: npm ci
49+
50+
- name: Build Ionic
51+
working-directory: frontend
52+
run: npm run build
53+
54+
- name: Prepare Capacitor for iOS
55+
working-directory: frontend
56+
run: |
57+
npx cap sync ios
58+
npx cap copy ios
59+
60+
- name: Install CocoaPods
61+
working-directory: frontend/ios/App
62+
run: pod install --verbose
63+
64+
- name: Install Fastlane
65+
working-directory: frontend/ios/App
66+
run: gem install fastlane
67+
68+
- name: Setup SSH for Fastlane Match Repo Access
69+
run: |
70+
mkdir -p ~/.ssh
71+
echo "${{ secrets.IOS_SIGNING_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
72+
chmod 600 ~/.ssh/id_rsa
73+
ssh-keyscan github.com >> ~/.ssh/known_hosts
74+
75+
- name: Decode App Store API Key
76+
working-directory: frontend/ios/App
77+
env:
78+
IOS_API_KEY_JSON: ${{ secrets.IOS_API_KEY_JSON }}
79+
run: echo "$IOS_API_KEY_JSON" > /tmp/api-key.json
80+
81+
- name: Set up Fastlane Match Password
82+
run: echo "MATCH_PASSWORD=${{ secrets.FASTLANE_MATCH_PASSWORD }}" >> $GITHUB_ENV
83+
84+
- name: Build iOS App for Simulator
85+
working-directory: frontend/ios/App
86+
env:
87+
NSUnbufferedIO: "YES"
88+
FASTLANE_VERBOSE: "1"
89+
run: |
90+
bundle install
91+
bundle exec fastlane ios build_for_simulator --verbose
92+
93+
- name: Upload App.app (iOS Simulator File)
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: build_for_simulator
97+
path: frontend/ios/App/build/simulator/App.xcarchive/Products/Applications/
98+
retention-days: 7
99+
100+
- name: Build iOS App for testflight.
101+
working-directory: frontend/ios/App
102+
env:
103+
NSUnbufferedIO: "YES"
104+
FASTLANE_VERBOSE: "1"
105+
FASTLANE_MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }}
106+
run: |
107+
bundle install
108+
bundle exec fastlane ios build_and_send_to_testflight --verbose
109+
110+
- name: Upload App.ipa (iOS device installation)
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: build_for_device
114+
path: frontend/ios/App/build/device/App.ipa
115+
retention-days: 7

frontend/ios/App/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

frontend/ios/App/fastlane/Appfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
app_identifier("com.moduscreate.appmedaidiy")
2+
apple_id("[email protected]")
3+
team_id("287TS9B2H2")

frontend/ios/App/fastlane/Fastfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
platform :ios do
2+
desc "Build .app for iOS Simulator(Debug) without code signing"
3+
lane :build_for_simulator do
4+
setup_ci(force: true)
5+
build_app(
6+
scheme: "App",
7+
configuration: "Debug",
8+
skip_package_ipa: true,
9+
build_path: "./build",
10+
destination: "generic/platform=iOS Simulator",
11+
archive_path: "./build/simulator/App.xcarchive",
12+
sdk: "iphonesimulator",
13+
skip_codesigning: true,
14+
clean: true
15+
)
16+
end
17+
18+
desc "build and send development build to testflight"
19+
lane :build_and_send_to_testflight do
20+
setup_ci(force: true)
21+
sync_code_signing(
22+
type: "development",
23+
readonly: true,
24+
api_key_path: "/tmp/api-key.json",
25+
git_url: "[email protected]:moduslabs/ios-signing-certificates.git",
26+
git_branch: "master"
27+
)
28+
29+
sync_code_signing(
30+
type: "appstore",
31+
readonly: true,
32+
api_key_path: "/tmp/api-key.json",
33+
git_url: "[email protected]:moduslabs/ios-signing-certificates.git",
34+
git_branch: "master"
35+
)
36+
37+
# latest_build_number = app_store_build_number(
38+
# app_identifier: "com.moduscreate.appmedaigen",
39+
# api_key_path: "/tmp/api-key.json",
40+
# live: false
41+
# )
42+
43+
# increment_build_number(build_number: latest_build_number + 1)
44+
45+
build_app(
46+
workspace: "App.xcworkspace",
47+
scheme: "App",
48+
sdk: "iphoneos",
49+
configuration: "Release",
50+
export_method: "app-store",
51+
clean: true,
52+
output_directory: "./build/device",
53+
output_name: "App.ipa",
54+
xcargs: "CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=287TS9B2H2 PROVISIONING_PROFILE_SPECIFIER='match Development com.moduscreate.appmedaigen'"
55+
)
56+
57+
upload_to_testflight(
58+
api_key_path: "/tmp/api-key.json",
59+
skip_submission: false,
60+
skip_waiting_for_build_processing: true,
61+
submit_beta_review: false, #Change it to true, once it's beta ready for external testers.
62+
)
63+
end
64+
end

0 commit comments

Comments
 (0)