Skip to content

Commit bff01f6

Browse files
authored
Merge pull request #9 from team-native/feat/#8-setup-cicd
chore: CI 파이프라인 구축
2 parents 14a8084 + 4a740ce commit bff01f6

2 files changed

Lines changed: 143 additions & 0 deletions

File tree

‎.github/workflows/cd.yml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
deploy:
14+
name: Deploy to TestFlight
15+
runs-on: macos-15
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup mise
22+
uses: jdx/mise-action@v2
23+
24+
- name: Cache Tuist
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.tuist/Cache
28+
key: ${{ runner.os }}-tuist-${{ hashFiles('mise.toml') }}
29+
restore-keys: |
30+
${{ runner.os }}-tuist-
31+
32+
- name: Install xcpretty
33+
run: gem install xcpretty
34+
35+
- name: Install dependencies
36+
run: tuist install
37+
38+
- name: Generate project
39+
run: tuist generate --no-open
40+
41+
- name: Import signing certificate
42+
env:
43+
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
44+
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
45+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
46+
run: |
47+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
48+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
49+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
50+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
51+
echo -n "$CERTIFICATE_BASE64" | base64 --decode -o $RUNNER_TEMP/cert.p12
52+
security import $RUNNER_TEMP/cert.p12 -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
53+
security list-keychain -d user -s $KEYCHAIN_PATH
54+
55+
- name: Import provisioning profile
56+
env:
57+
PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
58+
run: |
59+
PP_PATH=$RUNNER_TEMP/profile.mobileprovision
60+
echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH
61+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
62+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/
63+
64+
- name: Archive
65+
run: |
66+
xcodebuild archive \
67+
-workspace Book-on-iOS-V1.xcworkspace \
68+
-scheme Book-on-iOS-V1 \
69+
-destination 'generic/platform=iOS' \
70+
-archivePath $RUNNER_TEMP/Book-on-iOS-V1.xcarchive \
71+
| xcpretty && exit ${PIPESTATUS[0]}
72+
73+
- name: Export IPA
74+
env:
75+
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
76+
run: |
77+
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
78+
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
79+
xcodebuild -exportArchive \
80+
-archivePath $RUNNER_TEMP/Book-on-iOS-V1.xcarchive \
81+
-exportOptionsPlist $EXPORT_OPTS_PATH \
82+
-exportPath $RUNNER_TEMP/ipa
83+
84+
- name: Upload to TestFlight
85+
env:
86+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
87+
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
88+
ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
89+
run: |
90+
xcrun altool --upload-app \
91+
--type ios \
92+
--file $RUNNER_TEMP/ipa/Book-on-iOS-V1.ipa \
93+
--apiKey "$ASC_KEY_ID" \
94+
--apiIssuer "$ASC_ISSUER_ID" \
95+
--apiKey-file <(echo "$ASC_PRIVATE_KEY")

‎.github/workflows/ci.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- dev
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
name: Build
15+
runs-on: macos-15
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup mise
22+
uses: jdx/mise-action@v2
23+
24+
- name: Cache Tuist
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.tuist/Cache
28+
key: ${{ runner.os }}-tuist-${{ hashFiles('mise.toml') }}
29+
restore-keys: |
30+
${{ runner.os }}-tuist-
31+
32+
- name: Install xcpretty
33+
run: gem install xcpretty
34+
35+
- name: Install dependencies
36+
run: tuist install
37+
38+
- name: Generate project
39+
run: tuist generate --no-open
40+
41+
- name: Build
42+
run: |
43+
xcodebuild build \
44+
-workspace Book-on-iOS-V1.xcworkspace \
45+
-scheme Book-on-iOS-V1 \
46+
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
47+
CODE_SIGNING_ALLOWED=NO \
48+
| xcpretty && exit ${PIPESTATUS[0]}

0 commit comments

Comments
 (0)