Skip to content

Commit 7955722

Browse files
authored
[#258] 런타임에 필요한 파일들이 리포에 올라오지 않아 CD 후 크래시가 나는 이슈를 해결한다 (#262)
* chore: .bundle 추가 * refactor: 더 정확한 ipa 파일 위치를 찾도록 개선 * feat: 런타임에 필요한 파일들을 private 리포에서 가져오도록 추가 * refactor: 임시 디렉터리 정리 견고화
1 parent 63210c1 commit 7955722

6 files changed

Lines changed: 90 additions & 1 deletion

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Install Private Config
2+
description: Fetch Config.xcconfig and GoogleService-Info.plist from a private repository.
3+
4+
inputs:
5+
git_url:
6+
description: Private repository git URL
7+
required: true
8+
git_basic_authorization:
9+
description: Base64-encoded basic authorization header value
10+
required: true
11+
ref:
12+
description: Git ref to fetch from the private repository
13+
required: false
14+
default: iOS
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install private config files
20+
shell: bash
21+
env:
22+
PRIVATE_CONFIG_GIT_URL: ${{ inputs.git_url }}
23+
PRIVATE_CONFIG_GIT_BASIC_AUTHORIZATION: ${{ inputs.git_basic_authorization }}
24+
PRIVATE_CONFIG_REF: ${{ inputs.ref }}
25+
run: |
26+
set -euo pipefail
27+
28+
privateConfigCheckoutPath="$RUNNER_TEMP/private-config"
29+
trap 'rm -rf "$privateConfigCheckoutPath"' EXIT
30+
configSourcePath="$privateConfigCheckoutPath/resources/DevLog/Config.xcconfig"
31+
googleServiceInfoSourcePath="$privateConfigCheckoutPath/resources/DevLog/GoogleService-Info.plist"
32+
configDestinationPath="$GITHUB_WORKSPACE/DevLog/Resource/Config.xcconfig"
33+
googleServiceInfoDestinationPath="$GITHUB_WORKSPACE/DevLog/Resource/GoogleService-Info.plist"
34+
35+
rm -rf "$privateConfigCheckoutPath"
36+
mkdir -p "$privateConfigCheckoutPath"
37+
38+
git init "$privateConfigCheckoutPath"
39+
git -C "$privateConfigCheckoutPath" remote add origin "$PRIVATE_CONFIG_GIT_URL"
40+
git -C "$privateConfigCheckoutPath" config core.sparseCheckout true
41+
printf '%s\n' \
42+
'resources/DevLog/Config.xcconfig' \
43+
'resources/DevLog/GoogleService-Info.plist' \
44+
> "$privateConfigCheckoutPath/.git/info/sparse-checkout"
45+
46+
git -C "$privateConfigCheckoutPath" \
47+
-c http.extraheader="Authorization: Basic $PRIVATE_CONFIG_GIT_BASIC_AUTHORIZATION" \
48+
fetch --depth 1 origin "$PRIVATE_CONFIG_REF"
49+
git -C "$privateConfigCheckoutPath" checkout FETCH_HEAD
50+
51+
if [ ! -f "$configSourcePath" ]; then
52+
echo "Missing private config file at $configSourcePath" >&2
53+
exit 1
54+
fi
55+
56+
if [ ! -f "$googleServiceInfoSourcePath" ]; then
57+
echo "Missing private GoogleService-Info.plist at $googleServiceInfoSourcePath" >&2
58+
exit 1
59+
fi
60+
61+
install -m 600 "$configSourcePath" "$configDestinationPath"
62+
install -m 600 "$googleServiceInfoSourcePath" "$googleServiceInfoDestinationPath"

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
env:
77
SCHEME: DevLog
88
XCODE_VERSION: latest
9+
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
10+
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
911

1012
permissions:
1113
contents: read
@@ -49,6 +51,12 @@ jobs:
4951
steps:
5052
- uses: actions/checkout@v4
5153

54+
- name: Install private config files
55+
uses: ./.github/actions/install-private-config
56+
with:
57+
git_url: ${{ env.MATCH_GIT_URL }}
58+
git_basic_authorization: ${{ env.MATCH_GIT_BASIC_AUTHORIZATION }}
59+
5260
- name: Set up Xcode
5361
uses: maxim-lobanov/setup-xcode@v1
5462
with:

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
with:
3535
ref: ${{ github.event.pull_request.merge_commit_sha }}
3636

37+
- name: Install private config files
38+
uses: ./.github/actions/install-private-config
39+
with:
40+
git_url: ${{ env.MATCH_GIT_URL }}
41+
git_basic_authorization: ${{ env.MATCH_GIT_BASIC_AUTHORIZATION }}
42+
3743
- name: Set up Ruby
3844
uses: ruby/setup-ruby@v1
3945
with:

.github/workflows/testflight.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ jobs:
3030
steps:
3131
- uses: actions/checkout@v4
3232

33+
- name: Install private config files
34+
uses: ./.github/actions/install-private-config
35+
with:
36+
git_url: ${{ env.MATCH_GIT_URL }}
37+
git_basic_authorization: ${{ env.MATCH_GIT_BASIC_AUTHORIZATION }}
38+
3339
- name: Set up Xcode
3440
uses: maxim-lobanov/setup-xcode@v1
3541
with:
@@ -61,6 +67,12 @@ jobs:
6167
- name: Checkout
6268
uses: actions/checkout@v4
6369

70+
- name: Install private config files
71+
uses: ./.github/actions/install-private-config
72+
with:
73+
git_url: ${{ env.MATCH_GIT_URL }}
74+
git_basic_authorization: ${{ env.MATCH_GIT_BASIC_AUTHORIZATION }}
75+
6476
- name: Set up Ruby
6577
uses: ruby/setup-ruby@v1
6678
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ node_modules/
2323
lib/
2424

2525
# Gem
26+
.bundle/
2627
vendor/bundle/
2728

2829
# Fastlane

fastlane/Fastfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ platform :ios do
125125

126126
lane :upload_testflight_build do
127127
api_key = asc_api_key
128-
ipa_output_path = File.expand_path(TESTFLIGHT_IPA_OUTPUT_PATH, Dir.pwd)
128+
ipa_output_path = lane_context[SharedValues::IPA_OUTPUT_PATH].to_s
129129

130130
UI.user_error!("Missing built ipa at #{ipa_output_path}") if !File.exist?(ipa_output_path)
131131

0 commit comments

Comments
 (0)