Skip to content

Commit d4abae1

Browse files
author
Jaesung
authored
Merge pull request #42 from ku-ring/feature/jaesung/automation-build-app
2 parents cc54aa0 + 166ca8d commit d4abae1

File tree

10 files changed

+465
-10
lines changed

10 files changed

+465
-10
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: 쿠링 앱타겟 iOS17에서 빌드하기
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
jobs:
8+
build:
9+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, 'ios17 앱 빌드')
10+
runs-on: macos-13 #최신버전
11+
steps:
12+
# 빌드 요청 시작
13+
- name: Build iOS17
14+
run: |
15+
echo "iOS17 에서 앱 타겟을 빌드합니다."
16+
17+
# iOS17 빌드 응답 커멘트
18+
- name: Add Build comment
19+
uses: actions/github-script@v5
20+
with:
21+
github-token: ${{secrets.GITHUB_TOKEN}}
22+
script: |
23+
github.rest.issues.createComment({
24+
issue_number: context.issue.number,
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
body: '🔨 iOS 17.0 iPhone 14 Pro 에서 쿠링 앱을 빌드합니다.'
28+
})
29+
30+
# 코드를 체크아웃 합니다.
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
34+
# Xcode 버전을 설정합니다.
35+
- name: Setup Xcode version
36+
uses: maxim-lobanov/setup-xcode@v1
37+
with:
38+
xcode-version: '15.0'
39+
40+
# KuringApp 스킴을 빌드합니다.
41+
- name: KuringApp 빌드
42+
run: |
43+
cd KuringApp
44+
xcodebuild build -scheme KuringApp -destination 'platform=iOS Simulator,OS=17.0,name=iPhone 14 Pro'
45+
46+
# 빌드 성공시 커멘트
47+
- name: Add Build comment
48+
uses: actions/github-script@v5
49+
with:
50+
github-token: ${{secrets.GITHUB_TOKEN}}
51+
script: |
52+
github.rest.issues.createComment({
53+
issue_number: context.issue.number,
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
body: '✅ iOS17 에서 앱 타겟을 성공적으로 빌드했습니다.'
57+
})
58+
59+
# 빌드 실패시 커멘트
60+
- name: Notify failure
61+
uses: actions/github-script@v5
62+
with:
63+
github-token: ${{secrets.GITHUB_TOKEN}}
64+
script: |
65+
github.rest.issues.createComment({
66+
issue_number: context.issue.number,
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
body: '📬 iOS17 에서 앱 타겟 빌드에 실패했습니다. Actions에서 실패 결과를 확인해주세요.'
70+
})
71+
if: failure()

.github/workflows/BUILD_PACKAGE.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: 쿠링 스위프트 패키지 빌드하기
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
jobs:
8+
build:
9+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, '패키지 빌드')
10+
runs-on: macos-13 #최신버전
11+
steps:
12+
# 빌드 요청 시작
13+
- name: Build iOS17
14+
run: |
15+
echo "start build"
16+
17+
# build package 빌드 응답 커멘트
18+
- name: Add Build comment
19+
uses: actions/github-script@v5
20+
with:
21+
github-token: ${{secrets.GITHUB_TOKEN}}
22+
script: |
23+
github.rest.issues.createComment({
24+
issue_number: context.issue.number,
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
body: '🔨 iOS 16.2 iPhone 14 Pro 에서 스위프트 패키지를 빌드합니다.'
28+
})
29+
30+
# 코드를 체크아웃 합니다.
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
34+
# Xcode 버전을 설정합니다.
35+
- name: Setup Xcode version
36+
uses: maxim-lobanov/setup-xcode@v1
37+
with:
38+
xcode-version: '15.0'
39+
40+
# KuringModulePackage 패키지를 빌드합니다. (최소 버전)
41+
- name: KuringModulePackage 빌드
42+
run: |
43+
cd KuringModulePackage
44+
xcodebuild build -scheme KuringModulePackage -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14 Pro'
45+
46+
# 빌드 성공시 커멘트
47+
- name: Add Build comment
48+
uses: actions/github-script@v5
49+
with:
50+
github-token: ${{secrets.GITHUB_TOKEN}}
51+
script: |
52+
github.rest.issues.createComment({
53+
issue_number: context.issue.number,
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
body: '✅ 패키지를 성공적으로 빌드했습니다.'
57+
})
58+
59+
# 빌드 실패시 커멘트
60+
- name: Notify failure
61+
uses: actions/github-script@v5
62+
with:
63+
github-token: ${{secrets.GITHUB_TOKEN}}
64+
script: |
65+
github.rest.issues.createComment({
66+
issue_number: context.issue.number,
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
body: '📬 패키지 빌드에 실패했습니다. Actions에서 실패 결과를 확인해주세요.'
70+
})
71+
if: failure()

.github/workflows/MERGE_PR.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: PR을 자동 머지 합니다
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
jobs:
8+
automerge-pr:
9+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/쿠링') && contains(github.event.comment.body, '머지')
10+
runs-on: ubuntu-latest #최신버전
11+
steps:
12+
## 체크아웃
13+
- name: checkout
14+
uses: actions/checkout@v2
15+
16+
## automerge 라벨 추가
17+
- name: add label
18+
uses: actions-ecosystem/action-add-labels@v1
19+
with:
20+
labels: automerge
21+
22+
# 머지 시도 시작
23+
- name: Build iOS17
24+
run: |
25+
echo "PR 머지를 시도합니다"
26+
27+
# 자동 머지
28+
- id: automerge # 라벨과 관련이 있나...?
29+
name: automerge
30+
uses: "pascalgn/[email protected]"
31+
env:
32+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
33+
MERGE_METHOD: "squash" # 스쿼시하고 머지
34+
MERGE_REQUIRED_APPROVALS: "1" # 최소 승인 개수
35+
36+
# 머지 완료 알리기
37+
- name: Notify Merge
38+
if: steps.automerge.outputs.mergeResult == 'merged'
39+
uses: actions/github-script@v5
40+
with:
41+
github-token: ${{secrets.GITHUB_TOKEN}}
42+
script: |
43+
github.rest.issues.createComment({
44+
issue_number: context.issue.number,
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
body: '🕊️ PR #${{ steps.automerge.outputs.pullRequestNumber }}이 머지되었습니다.'
48+
})
49+
50+
# 머지 실패 알리기
51+
- name: Notify failure
52+
if: steps.automerge.outputs.mergeResult != 'merged'
53+
uses: actions/github-script@v5
54+
with:
55+
github-token: ${{secrets.GITHUB_TOKEN}}
56+
script: |
57+
github.rest.issues.createComment({
58+
issue_number: context.issue.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
body: '🗿 머지 시도 실패. 승인 개수, 테스트 성공 여부 등 자동 머지 조건을 만족하는지 확인하세요.'
62+
})

0 commit comments

Comments
 (0)