Skip to content

Commit 3d4e020

Browse files
authored
Merge pull request #10 from mendix/feat-setup-release-pipeline-ios
Feat setup release pipeline ios
2 parents 826552c + 0ba67c1 commit 3d4e020

File tree

11 files changed

+74
-288
lines changed

11 files changed

+74
-288
lines changed
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
name: 'Build iOS App'
2-
description: 'Builds the iOS app using Fastlane'
1+
name: 'Build & Upload iOS App'
2+
description: 'Build and upload the iOS app using Fastlane'
33

44
runs:
55
using: 'composite'
66

77
steps:
8-
- name: Hello Function
9-
run: echo "Hello!"
10-
shell: bash
11-
128
- name: Set up Ruby
139
uses: ruby/setup-ruby@v1
1410
with:
1511
ruby-version: '2.7'
1612

1713
- name: Install Fastlane
1814
run: gem install fastlane
15+
shell: bash
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version-file: .nvmrc
21+
22+
- name: Run Fastlane
23+
run: cd ios && fastlane ios release
1924
shell: bash

.github/workflows/build_ios.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "iOS Test"
1+
name: "Build & Upload iOS App"
22

33
on:
44
push:
@@ -16,5 +16,13 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v3
1818

19-
- name: Build iOS
19+
- name: Build & Upload iOS App
2020
uses: ./.github/actions/build_ios
21+
env:
22+
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
23+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
24+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
25+
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
26+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
27+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
28+
APP_STORE_CONNECT_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_KEY_CONTENT }}

ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ EXTERNAL SOURCES:
10991099
:path: "../node_modules/react-native/ReactCommon/yoga"
11001100

11011101
SPEC CHECKSUMS:
1102-
boost: a7c83b31436843459a1961bfd74b96033dc77234
1102+
boost: 57d2868c099736d80fcd648bf211b4431e51a558
11031103
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
11041104
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
11051105
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
@@ -1141,7 +1141,7 @@ SPEC CHECKSUMS:
11411141
Permission-PhotoLibrary: ddb5a158725b29cb12e9e477e8a5f5151c66cc3c
11421142
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
11431143
QRCodeReader.swift: 373a389fe9a22d513c879a32a6f647c58f4ef572
1144-
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
1144+
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
11451145
RCTRequired: 83bca1c184feb4d2e51c72c8369b83d641443f95
11461146
RCTTypeSafety: 13c4a87a16d7db6cd66006ce9759f073402ef85b
11471147
React: e67aa9f99957c7611c392b5e49355d877d6525e2
@@ -1225,4 +1225,4 @@ SPEC CHECKSUMS:
12251225

12261226
PODFILE CHECKSUM: 5aa659dbdffe4dac60d7c41c77158d6182cc0f9c
12271227

1228-
COCOAPODS: 1.14.3
1228+
COCOAPODS: 1.15.2

ios/developerapp.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@
734734
CODE_SIGN_IDENTITY = "Apple Development";
735735
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
736736
CODE_SIGN_STYLE = Manual;
737-
CURRENT_PROJECT_VERSION = 20;
737+
CURRENT_PROJECT_VERSION = 23;
738738
DEAD_CODE_STRIPPING = YES;
739739
DEVELOPMENT_TEAM = BC32QNM6AD;
740740
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
@@ -803,7 +803,7 @@
803803
CODE_SIGN_IDENTITY = "Apple Development";
804804
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
805805
CODE_SIGN_STYLE = Manual;
806-
CURRENT_PROJECT_VERSION = 20;
806+
CURRENT_PROJECT_VERSION = 23;
807807
DEVELOPMENT_TEAM = BC32QNM6AD;
808808
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
809809
ENABLE_BITCODE = NO;
@@ -1068,7 +1068,7 @@
10681068
CODE_SIGN_IDENTITY = "Apple Development";
10691069
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
10701070
CODE_SIGN_STYLE = Manual;
1071-
CURRENT_PROJECT_VERSION = 20;
1071+
CURRENT_PROJECT_VERSION = 23;
10721072
DEVELOPMENT_TEAM = BC32QNM6AD;
10731073
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = BC32QNM6AD;
10741074
ENABLE_BITCODE = NO;

ios/fastlane/Appfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
app_identifier "com.mendix.developerapp.native.mx10" # The bundle identifier of your app
1+
app_identifier("com.mendix.developerapp.native.mx10")
22

3-
team_id "BC32QNM6AD" # Developer Portal Team ID
43

5-
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

ios/fastlane/Fastfile

Lines changed: 42 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,78 @@
1-
# If you want to automatically update fastlane if a new version is available:
2-
#update_fastlane
3-
4-
# This is the minimum version number required.
5-
# Update this, if you use features of a newer version
6-
fastlane_version "2.213.0"
7-
8-
default_platform :ios
9-
101
# Constants
112
APPLE_STORE_VERSION = sh("node -p -e \"require('../../package.json')['store-versions']['apple-store']\"").chomp
12-
BUILD_NUMBER = 1
13-
ORIGINAL_CHANGELOG_PATH = "../../CHANGELOG.ios.txt"
14-
FASTLANE_CHANGELOG_PATH = "./metadata/default/release_notes.txt"
153

16-
platform :ios do
17-
lane :install_dev_certificate do
18-
# Improve DX. We cannot use an empty password, so we use the public password.
19-
ENV["MATCH_PASSWORD"] = "AppleDeveloper1!"
20-
match(
21-
type: "development",
22-
git_branch: "appdev",
23-
profile_name: "Make It Native 9 Dev (Match)",
24-
readonly: true,
25-
)
26-
end
27-
28-
desc "Build an internal version for automation"
29-
desc "It always uses v.0.0.0 and build number 0 by design"
30-
lane :internal do
31-
sh("npm", "ci", "--legacy-peer-deps")
32-
cocoapods
33-
increment_version_number(
34-
version_number: "0.0.0",
35-
)
36-
gym(scheme: "DeveloperApp", configuration: "ReleaseDevToolsEnabled", export_method: "development", build_path: "./builds/internal/intermediate", output_directory: "./builds/internal/output")
37-
end
4+
default_platform(:ios)
385

39-
desc "Builds and install DeveloperApp into the simulator"
40-
desc "This will use iPhone 13 Pro simulator with OS 15.5"
41-
lane :debug_internal do
42-
UI.message("Installing dependencies")
43-
sh("npm", "i", "--legacy-peer-deps")
44-
cocoapods
45-
UI.message("Building and installing DeveloperApp")
46-
gym(
47-
scheme: "DeveloperApp",
48-
configuration: "Debug",
49-
skip_package_ipa: true,
50-
skip_package_pkg: true,
51-
sdk: "iphonesimulator",
52-
destination: "platform=iOS Simulator,name=iPhone 13 Pro,OS=15.5",
53-
xcargs: "ONLY_ACTIVE_ARCH=NO",
6+
platform :ios do
7+
desc "Upload a new build to AppStore"
8+
lane :release do
9+
keychain_name = "MiN_10_keychain"
10+
create_keychain(
11+
name: keychain_name,
12+
default_keychain: true,
13+
unlock: true,
14+
timeout: 3600,
15+
password: ENV["KEYCHAIN_PASSWORD"],
16+
lock_when_sleeps: false
5417
)
55-
end
56-
57-
desc "Submit a new Beta Build to Apple TestFlight"
58-
desc "This will also make sure the profile is up to date"
59-
lane :beta do |options|
60-
keychain_name = "min_10_ios"
6118
sh("npm", "ci", "--legacy-peer-deps")
6219
cocoapods
6320

64-
UI.message("Connect API key")
65-
app_store_connect_api_key(
66-
is_key_content_base64: true,
67-
)
68-
69-
create_keychain(
70-
name: keychain_name,
71-
unlock: true,
72-
timeout: 0,
73-
default_keychain: true,
21+
api_key = app_store_connect_api_key(
22+
key_id: ENV["APP_STORE_CONNECT_KEY_ID"],
23+
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
24+
key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"],
25+
duration: 1200, # Session Length in seconds (maximum: 1200).
7426
)
7527

76-
UI.message("Retrieve iOS certificate and profile")
28+
UI.message("Disabling automatic signing on Xcode")
29+
disable_automatic_code_signing
30+
31+
UI.message("Get the certificates and profiles")
7732
match(
78-
type: "appstore",
79-
keychain_name: keychain_name,
33+
type:"appstore",
34+
api_key:api_key,
35+
keychain_name:keychain_name,
8036
keychain_password: ENV["KEYCHAIN_PASSWORD"],
81-
profile_name: "match AppStore com.mendix.developerapp.native.mx10",
82-
readonly: true,
37+
git_basic_authorization:ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
38+
readonly: false,
8339
)
8440

8541
UI.message("Set version number")
8642
increment_version_number(
8743
version_number: APPLE_STORE_VERSION,
8844
)
8945

90-
UI.message("Set build number")
91-
increment_build_number(
92-
build_number: app_store_build_number(live: false, version: APPLE_STORE_VERSION, initial_build_number: 0) + 1,
46+
UI.message("Get the latest build number from AppStore Connect")
47+
build_num = app_store_build_number(
48+
live: false,
49+
initial_build_number: 0,
50+
api_key: api_key,
51+
version: APPLE_STORE_VERSION,
9352
)
9453

95-
unlock_keychain( # Unlock an existing keychain and add it to the keychain search list
96-
path: keychain_name,
97-
password: ENV["KEYCHAIN_PASSWORD"],
98-
)
99-
100-
update_project_provisioning(
54+
UI.message("Set build number")
55+
increment_build_number(
10156
xcodeproj: "developerapp.xcodeproj",
102-
code_signing_identity: "Apple Distribution",
103-
profile: ENV["sigh_com.mendix.developerapp.native.mx10_appstore_profile-path"],
104-
build_configuration: "Release",
105-
target_filter: "DeveloperApp",
57+
build_number: build_num + 1,
10658
)
10759

60+
10861
UI.message("Replacing Google Maps API key from environment variables")
10962
Dir.chdir("../DeveloperApp/Config") do
11063
googleMapsApiKey = ENV["GOOGLE_MAPS_API_KEY"] || "GOOGLE_MAPS_API_KEY"
11164
sh("sed -i '' 's/{{google-maps-api-key}}/#{googleMapsApiKey}/g' ApiKeys.xcconfig")
11265
end
113-
114-
UI.message("Build iOS app")
115-
gym(
66+
67+
build_app(
68+
workspace: "DeveloperApp.xcworkspace",
11669
scheme: "DeveloperApp",
117-
export_method: "app-store",
118-
configuration: "Release",
119-
output_directory: "./build/beta/output",
120-
)
121-
122-
if options[:submit] == true
123-
UI.message("Send iOS app to TestFlight")
124-
pilot(
125-
groups: ["Internal Testers"],
126-
skip_submission: true,
127-
skip_waiting_for_build_processing: true,
128-
distribute_external: false
129-
)
130-
end
131-
132-
UI.message("Copy artifacts")
133-
copy_artifacts(
134-
target_path: "../artifacts",
135-
artifacts: ["./build/beta/output/DeveloperApp.ipa",
136-
"./build/beta/output/DeveloperApp.app.dSYM.zip"],
137-
)
138-
end
139-
140-
lane :beta_manually do
141-
sh("npm", "ci", "--legacy-peer-deps")
142-
cocoapods
143-
144-
UI.message("Retrieve iOS certificate and profile")
145-
match(
146-
type: "appstore",
147-
profile_name: "match AppStore com.mendix.developerapp.native.mx10",
148-
readonly: true,
149-
)
150-
151-
UI.message("Set version number")
152-
increment_version_number(
153-
version_number: APPLE_STORE_VERSION,
70+
build_path:"./build",
71+
output_directory:"./build"
15472
)
155-
156-
UI.message("Set build number")
157-
increment_build_number(
158-
build_number: app_store_build_number(live: false, version: APPLE_STORE_VERSION, initial_build_number: 0) + 1,
159-
)
160-
161-
UI.message("Build iOS app")
162-
gym(
163-
scheme: "DeveloperApp",
164-
export_method: "app-store",
165-
configuration: "Release",
166-
output_directory: "./build/beta/output",
167-
)
168-
169-
UI.message("Send iOS app to TestFlight")
170-
pilot(
171-
skip_submission: true,
73+
upload_to_testflight(
17274
skip_waiting_for_build_processing: true,
17375
)
174-
175-
UI.message("Copy artifacts")
176-
copy_artifacts(
177-
target_path: "../artifacts",
178-
artifacts: ["./build/beta/output/DeveloperApp.ipa",
179-
"./build/beta/output/DeveloperApp.app.dSYM.zip"],
180-
)
18176
end
18277

183-
desc "Send appstore version to review"
184-
lane :promote_to_production do |options|
185-
if !options[:build_number]
186-
UI.user_error!("build_number is required to release app")
187-
end
188-
189-
FileUtils.copy(ORIGINAL_CHANGELOG_PATH, FASTLANE_CHANGELOG_PATH)
190-
191-
UI.message("Connect API key")
192-
app_store_connect_api_key(
193-
is_key_content_base64: true,
194-
)
195-
196-
deliver(
197-
app_version: APPLE_STORE_VERSION,
198-
build_number: options[:build_number],
199-
submit_for_review: true,
200-
automatic_release: true,
201-
force: true,
202-
skip_metadata: false,
203-
skip_screenshots: true,
204-
skip_binary_upload: true,
205-
precheck_include_in_app_purchases: false,
206-
submission_information: {
207-
add_id_info_uses_idfa: false,
208-
export_compliance_uses_encryption: false,
209-
},
210-
)
211-
end
21278
end

ios/fastlane/Matchfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
git_url("[email protected]:mobile-offline/ios-credentials-min-10.git")
2-
1+
git_url("https://github.com/mendix/make-it-native-ios-credentials.git")
32
storage_mode("git")
43

5-
type("appstore") # The default type, can be: appstore, adhoc, enterprise or development
6-
7-
app_identifier(["com.mendix.developerapp.native.mx10"])
8-
9-
# The docs are available on https://docs.fastlane.tools/actions/match
4+
type("appstore")
5+
app_identifier("com.mendix.developerapp.native.mx10")

0 commit comments

Comments
 (0)