Skip to content

Commit 457d394

Browse files
committed
[feat] 워크플로우 개편
1 parent 6e0ff82 commit 457d394

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+863
-310
lines changed
Lines changed: 175 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,185 @@
1-
# This workflow will build a Swift project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3-
4-
name: appstore-release
1+
name: App Store Release
52

63
on:
74
pull_request:
85
branches:
96
- main
7+
types:
8+
- closed
9+
10+
workflow_dispatch:
1011

1112
jobs:
12-
build:
13+
deploy:
14+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
1315
runs-on: macos-26
16+
timeout-minutes: 120
17+
18+
env:
19+
# App Store Connect
20+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
21+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
22+
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
23+
24+
# Team IDs
25+
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
26+
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
27+
28+
# Match (Code Signing)
29+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
30+
MATCH_KEYCHAIN_NAME: fastlane_tmp.keychain-db
31+
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
32+
33+
# Review Information
34+
DEMO_USER: ${{ secrets.DEMO_USER }}
35+
DEMO_PASSWORD: ${{ secrets.DEMO_PASSWORD }}
36+
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
37+
38+
# Fastlane
39+
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: '120'
40+
FASTLANE_XCODE_LIST_TIMEOUT: '120'
41+
FASTLANE_DISABLE_COLORS: 'true'
1442

1543
steps:
16-
- uses: actions/checkout@v4
17-
18-
- name: Set up Xcode
19-
uses: maxim-lobanov/setup-xcode@v1
20-
with:
21-
xcode-version: latest-stable
22-
23-
- uses: shimataro/ssh-key-action@v2
24-
with:
25-
key: ${{ secrets.SSH_KEY }}
26-
known_hosts: ${{ secrets.KNOWN_HOSTS }}
27-
28-
- name: initial mise
29-
run: |
30-
curl https://mise.jdx.dev/install.sh | sh
31-
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
32-
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
33-
34-
- name: initial tuist
35-
run: mise install tuist
36-
37-
- name: Generate Project
38-
env:
39-
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
40-
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
41-
run: |
42-
fastlane appstore_profile
43-
make release
44-
45-
- name: Build Archive
46-
env:
47-
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
48-
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
49-
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
50-
run: fastlane archive
51-
52-
- name: Appstore Release
53-
env:
54-
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
55-
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
56-
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
57-
run: fastlane appstore_release
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Xcode
48+
uses: maxim-lobanov/setup-xcode@v1
49+
with:
50+
xcode-version: latest-stable
51+
52+
- name: Setup Ruby
53+
uses: ruby/setup-ruby@v1
54+
with:
55+
ruby-version: '3.3'
56+
bundler-cache: true
57+
58+
- name: Setup SSH for Match
59+
if: env.MATCH_GIT_PRIVATE_KEY != ''
60+
run: |
61+
mkdir -p "$HOME/.ssh"
62+
echo "$MATCH_GIT_PRIVATE_KEY" > "$HOME/.ssh/match_git_key"
63+
chmod 600 "$HOME/.ssh/match_git_key"
64+
65+
eval "$(ssh-agent -s)"
66+
ssh-add "$HOME/.ssh/match_git_key"
67+
ssh-keyscan -H github.com >> "$HOME/.ssh/known_hosts"
68+
69+
cat >> "$HOME/.ssh/config" << EOF
70+
Host github.com
71+
IdentityFile ~/.ssh/match_git_key
72+
StrictHostKeyChecking yes
73+
User git
74+
EOF
75+
76+
- name: Setup SSH for Private repo
77+
uses: shimataro/ssh-key-action@v2
78+
with:
79+
key: ${{ secrets.SSH_KEY }}
80+
known_hosts: ${{ secrets.KNOWN_HOSTS }}
81+
82+
- name: Setup keychain
83+
if: env.MATCH_PASSWORD != ''
84+
run: |
85+
security create-keychain -p "$MATCH_PASSWORD" "$MATCH_KEYCHAIN_NAME"
86+
security set-keychain-settings -lut 21600 "$MATCH_KEYCHAIN_NAME"
87+
security unlock-keychain -p "$MATCH_PASSWORD" "$MATCH_KEYCHAIN_NAME"
88+
89+
existing_keychains=$(security list-keychains | tr -d '"')
90+
security list-keychains -s "$MATCH_KEYCHAIN_NAME" $existing_keychains
91+
security default-keychain -s "$MATCH_KEYCHAIN_NAME"
92+
93+
- name: Setup mise
94+
run: |
95+
curl https://mise.jdx.dev/install.sh | sh
96+
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
97+
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
98+
99+
- name: Install Tuist
100+
run: mise install tuist
101+
102+
- name: Setup code signing
103+
run: bundle exec fastlane appstore_profile
104+
105+
- name: Generate project with Tuist
106+
run: make release
107+
108+
- name: Update release notes from PR description
109+
env:
110+
GH_TOKEN: ${{ github.token }}
111+
run: |
112+
PR_BODY=$(gh pr view ${{ github.event.pull_request.number }} --json body --jq '.body')
113+
114+
if [ -z "$PR_BODY" ]; then
115+
echo "버그 수정 및 성능 개선" > fastlane/release_notes.txt
116+
else
117+
echo "$PR_BODY" > fastlane/release_notes.txt
118+
fi
119+
120+
echo "Release notes updated:"
121+
cat fastlane/release_notes.txt
122+
123+
- name: Build archive
124+
run: bundle exec fastlane archive
125+
126+
- name: Submit to App Store
127+
run: bundle exec fastlane appstore_release
128+
129+
- name: Get app version
130+
id: version
131+
run: |
132+
VERSION=$(xcodebuild -project Projects/App/App.xcodeproj -showBuildSettings | grep MARKETING_VERSION | head -1 | awk '{print $3}')
133+
echo "version=$VERSION" >> $GITHUB_OUTPUT
134+
135+
- name: Create Git tag and Release draft
136+
env:
137+
GH_TOKEN: ${{ github.token }}
138+
run: |
139+
VERSION="${{ steps.version.outputs.version }}"
140+
TAG="v$VERSION"
141+
142+
# 태그 생성
143+
git config user.name "github-actions[bot]"
144+
git config user.email "github-actions[bot]@users.noreply.github.com"
145+
git tag -a "$TAG" -m "Release $VERSION"
146+
git push origin "$TAG"
147+
148+
# Release draft 생성
149+
PR_BODY=$(gh pr view ${{ github.event.pull_request.number }} --json body --jq '.body')
150+
if [ -z "$PR_BODY" ]; then
151+
RELEASE_NOTES="버그 수정 및 성능 개선"
152+
else
153+
RELEASE_NOTES="$PR_BODY"
154+
fi
155+
156+
gh release create "$TAG" \
157+
--title "Release $VERSION" \
158+
--notes "$RELEASE_NOTES" \
159+
--draft
160+
161+
- name: Upload logs on failure
162+
if: failure()
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: xcode-logs
166+
path: |
167+
~/Library/Logs/gym
168+
~/Library/Developer/Xcode/DerivedData
169+
/Users/runner/Library/Developer/Xcode/Archives
170+
if-no-files-found: ignore
171+
retention-days: 3
172+
173+
- name: Cleanup
174+
if: always()
175+
run: |
176+
# SSH cleanup
177+
if [ -n "$MATCH_GIT_PRIVATE_KEY" ]; then
178+
ssh-add -D >/dev/null 2>&1 || true
179+
rm -f "$HOME/.ssh/match_git_key"
180+
fi
181+
182+
# Keychain cleanup
183+
if [ -n "$MATCH_PASSWORD" ]; then
184+
security delete-keychain "$MATCH_KEYCHAIN_NAME" 2>/dev/null || true
185+
fi

.github/workflows/build_test.yml

Lines changed: 107 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will build a Swift project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3-
4-
name: build-test
1+
name: Build Test
52

63
on:
74
pull_request:
@@ -13,36 +10,111 @@ on:
1310
jobs:
1411
build:
1512
runs-on: macos-26
13+
timeout-minutes: 60
14+
15+
env:
16+
# Team IDs
17+
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
18+
19+
# Match (Code Signing)
20+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
21+
MATCH_KEYCHAIN_NAME: fastlane_tmp.keychain-db
22+
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
23+
24+
# Fastlane
25+
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: '120'
26+
FASTLANE_XCODE_LIST_TIMEOUT: '120'
27+
FASTLANE_DISABLE_COLORS: 'true'
1628

1729
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Set up Xcode
21-
uses: maxim-lobanov/setup-xcode@v1
22-
with:
23-
xcode-version: latest-stable
24-
25-
- uses: shimataro/ssh-key-action@v2
26-
with:
27-
key: ${{ secrets.SSH_KEY }}
28-
known_hosts: ${{ secrets.KNOWN_HOSTS }}
29-
30-
- name: initial mise
31-
run: |
32-
curl https://mise.jdx.dev/install.sh | sh
33-
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
34-
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
35-
36-
- name: initial tuist
37-
run: mise install tuist
38-
39-
- name: Test Generate
40-
env:
41-
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
42-
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
43-
run: |
44-
fastlane development_profile
45-
make test
46-
47-
- name: Build Test
48-
run: fastlane build
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Xcode
34+
uses: maxim-lobanov/setup-xcode@v1
35+
with:
36+
xcode-version: latest-stable
37+
38+
- name: Setup Ruby
39+
uses: ruby/setup-ruby@v1
40+
with:
41+
ruby-version: '3.3'
42+
bundler-cache: true
43+
44+
- name: Setup SSH for Match
45+
if: env.MATCH_GIT_PRIVATE_KEY != ''
46+
run: |
47+
mkdir -p "$HOME/.ssh"
48+
echo "$MATCH_GIT_PRIVATE_KEY" > "$HOME/.ssh/match_git_key"
49+
chmod 600 "$HOME/.ssh/match_git_key"
50+
51+
eval "$(ssh-agent -s)"
52+
ssh-add "$HOME/.ssh/match_git_key"
53+
ssh-keyscan -H github.com >> "$HOME/.ssh/known_hosts"
54+
55+
cat >> "$HOME/.ssh/config" << EOF
56+
Host github.com
57+
IdentityFile ~/.ssh/match_git_key
58+
StrictHostKeyChecking yes
59+
User git
60+
EOF
61+
62+
- name: Setup SSH for Private repo
63+
uses: shimataro/ssh-key-action@v2
64+
with:
65+
key: ${{ secrets.SSH_KEY }}
66+
known_hosts: unnecessary
67+
68+
- name: Setup keychain
69+
if: env.MATCH_PASSWORD != ''
70+
run: |
71+
security create-keychain -p "$MATCH_PASSWORD" "$MATCH_KEYCHAIN_NAME"
72+
security set-keychain-settings -lut 21600 "$MATCH_KEYCHAIN_NAME"
73+
security unlock-keychain -p "$MATCH_PASSWORD" "$MATCH_KEYCHAIN_NAME"
74+
75+
existing_keychains=$(security list-keychains | tr -d '"')
76+
security list-keychains -s "$MATCH_KEYCHAIN_NAME" $existing_keychains
77+
security default-keychain -s "$MATCH_KEYCHAIN_NAME"
78+
79+
- name: Setup mise
80+
run: |
81+
curl https://mise.jdx.dev/install.sh | sh
82+
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
83+
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
84+
85+
- name: Install Tuist
86+
run: mise install tuist
87+
88+
- name: Setup code signing
89+
run: bundle exec fastlane development_profile
90+
91+
- name: Generate project with Tuist
92+
run: make test
93+
94+
- name: Build Test
95+
run: bundle exec fastlane build
96+
97+
- name: Upload logs on failure
98+
if: failure()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: build-logs
102+
path: |
103+
~/Library/Logs/gym
104+
~/Library/Developer/Xcode/DerivedData
105+
if-no-files-found: ignore
106+
retention-days: 3
107+
108+
- name: Cleanup
109+
if: always()
110+
run: |
111+
# SSH cleanup
112+
if [ -n "$MATCH_GIT_PRIVATE_KEY" ]; then
113+
ssh-add -D >/dev/null 2>&1 || true
114+
rm -f "$HOME/.ssh/match_git_key"
115+
fi
116+
117+
# Keychain cleanup
118+
if [ -n "$MATCH_PASSWORD" ]; then
119+
security delete-keychain "$MATCH_KEYCHAIN_NAME" 2>/dev/null || true
120+
fi

0 commit comments

Comments
 (0)