Skip to content

Commit c522647

Browse files
authored
[#411] 위젯이 배포가능하도록 CI 코드를 수정한다 (#412)
* test: 위젯 identfier을 추가하여 위젯도 배포 가능하도록 수정 * ci: 위젯 프로파일 동기화 워크플로 추가 * ci: 프로파일 강제 갱신 옵션 추가
1 parent 1299e4b commit c522647

3 files changed

Lines changed: 94 additions & 14 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: iOS Code Signing
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
force:
7+
description: Force regenerate profiles
8+
required: true
9+
default: "true"
10+
type: choice
11+
options:
12+
- "true"
13+
- "false"
14+
15+
env:
16+
RUBY_VERSION: "3.2"
17+
APP_STORE_TEAM_ID: ${{ secrets.APP_STORE_TEAM_ID }}
18+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
19+
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
20+
ASC_KEY_PATH: fastlane/AuthKey.p8
21+
SPACESHIP_CONNECT_API_IN_HOUSE: "false"
22+
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
23+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
24+
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
25+
MATCH_FORCE: ${{ inputs.force }}
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
sync-appstore-profiles:
32+
runs-on: macos-latest
33+
timeout-minutes: 20
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v5
38+
39+
- name: Set up Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
bundler-cache: true
43+
ruby-version: ${{ env.RUBY_VERSION }}
44+
45+
- name: Write App Store Connect API key
46+
env:
47+
ASC_KEY_CONTENT: ${{ secrets.ASC_KEY_CONTENT }}
48+
run: |
49+
printf '%s' "$ASC_KEY_CONTENT" | base64 -D > "$ASC_KEY_PATH"
50+
51+
- name: Sync App Store profiles
52+
run: bundle exec fastlane sync_appstore_profiles

fastlane/Fastfile

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
XCODE_PROJ = "DevLog.xcodeproj"
22
APP_IDENTIFIER = "opfic.DevLog"
3+
WIDGET_IDENTIFIER = "opfic.DevLog.DevLogWidget"
4+
APP_IDENTIFIERS = [APP_IDENTIFIER, WIDGET_IDENTIFIER]
35
TARGET_NAME = "DevLog"
6+
WIDGET_TARGET_NAME = "DevLogWidgetExtension"
47
TESTFLIGHT_BUILD_OUTPUT_DIRECTORY = File.expand_path("testflight_build", __dir__)
58
TESTFLIGHT_IPA_OUTPUT_PATH = File.join(TESTFLIGHT_BUILD_OUTPUT_DIRECTORY, "#{TARGET_NAME}.ipa")
69

@@ -76,23 +79,32 @@ platform :ios do
7679
match(
7780
api_key: api_key,
7881
type: "appstore",
82+
app_identifier: APP_IDENTIFIERS,
7983
readonly: ENV["CI"] == "true"
8084
)
8185

8286
if ENV["CI"] == "true"
83-
provisioning_profile_specifier = lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING][APP_IDENTIFIER].to_s
84-
UI.user_error!("Missing App Store provisioning profile mapping for #{APP_IDENTIFIER}") if provisioning_profile_specifier.empty?
85-
86-
update_code_signing_settings(
87-
use_automatic_signing: false,
88-
path: XCODE_PROJ,
89-
sdk: "iphoneos*",
90-
team_id: ENV["APP_STORE_TEAM_ID"],
91-
targets: [TARGET_NAME],
92-
build_configurations: ["Release"],
93-
code_sign_identity: "Apple Distribution",
94-
profile_name: provisioning_profile_specifier
95-
)
87+
profile_mapping = lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
88+
signing_targets = {
89+
TARGET_NAME => APP_IDENTIFIER,
90+
WIDGET_TARGET_NAME => WIDGET_IDENTIFIER
91+
}
92+
93+
signing_targets.each do |target_name, app_identifier|
94+
provisioning_profile_specifier = profile_mapping[app_identifier].to_s
95+
UI.user_error!("Missing App Store provisioning profile mapping for #{app_identifier}") if provisioning_profile_specifier.empty?
96+
97+
update_code_signing_settings(
98+
use_automatic_signing: false,
99+
path: XCODE_PROJ,
100+
sdk: "iphoneos*",
101+
team_id: ENV["APP_STORE_TEAM_ID"],
102+
targets: [target_name],
103+
build_configurations: ["Release"],
104+
code_sign_identity: "Apple Distribution",
105+
profile_name: provisioning_profile_specifier
106+
)
107+
end
96108
end
97109

98110
build_app(
@@ -117,6 +129,19 @@ platform :ios do
117129
build_for_store
118130
end
119131

132+
lane :sync_appstore_profiles do
133+
api_key = asc_api_key
134+
match_force = ENV.fetch("MATCH_FORCE", "false") == "true"
135+
136+
match(
137+
api_key: api_key,
138+
type: "appstore",
139+
app_identifier: APP_IDENTIFIERS,
140+
force: match_force,
141+
readonly: false
142+
)
143+
end
144+
120145
lane :upload_testflight_build do
121146
api_key = asc_api_key
122147
# lane_context는 같은 fastlane 실행 내에서만 유지되므로, 별도 CI step에서는 고정 ipa 경로를 사용한다.

fastlane/Matchfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ git_url(ENV["MATCH_GIT_URL"])
33
storage_mode("git")
44
git_branch("main")
55
type("appstore")
6-
app_identifier(["opfic.DevLog"])
6+
app_identifier([
7+
"opfic.DevLog",
8+
"opfic.DevLog.DevLogWidget"
9+
])
710
team_id(ENV["APP_STORE_TEAM_ID"])
811
readonly(ENV["CI"] == "true")
912

0 commit comments

Comments
 (0)