Skip to content

Commit

Permalink
[feat] #26 코드 정리 및 상황별 워크플로우작성
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Jul 25, 2024
1 parent 4af94f5 commit 3a26a72
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 28 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: build-test

on:
pull_request:
branches: [ "develop" ]

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'

- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}

- name: initial mise
run: |
curl https://mise.jdx.dev/install.sh | sh
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
- name: initial tuist
run: mise install tuist

- name: Test Generate
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_URL: ${{ secrets.MATCH_URL }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
run: fastlane test generate

- name: Build Test
run: fastlane build test
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: feature-test
name: testflight_release

on:
push:
branches: [ "feature/*" ]
branches: [ "develop" ]

jobs:
build:
Expand All @@ -19,10 +19,10 @@ jobs:
with:
xcode-version: '15.4'

- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
# - uses: shimataro/ssh-key-action@v2
# with:
# key: ${{ secrets.SSH_KEY }}
# known_hosts: ${{ secrets.KNOWN_HOSTS }}

- name: initial mise
run: |
Expand All @@ -33,30 +33,24 @@ jobs:
- name: initial tuist
run: mise install tuist

# - name: Create key.json
# run: |
# mkdir -p fastlane
# echo '{
# "key_id": "${{ secrets.APP_STORE_CONNECT_KEY_ID }}",
# "issuer_id": "${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}",
# "key": "${{ secrets.APP_STORE_CONNECT_API }}",
# "duration": 1200,
# "in_house": false
# }' > fastlane/key.json

# - name: Match Fastlane
# env:
# MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
# run: fastlane match appstore --readonly

- name: Release TestFlight
- name: Generate Project
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_URL: ${{ secrets.MATCH_URL }}
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
run: fastlane generate

- name: Build Archive
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
run: fastlane build archive

- name: Beta Release
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
run: fastlane beta
run: fastlane beta release
67 changes: 67 additions & 0 deletions .github/workflows/workflow_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: testflight_release

on:
push:
branches: [ "feature/*" ]

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'

# - uses: shimataro/ssh-key-action@v2
# with:
# key: ${{ secrets.SSH_KEY }}
# known_hosts: ${{ secrets.KNOWN_HOSTS }}

- name: initial mise
run: |
curl https://mise.jdx.dev/install.sh | sh
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
- name: initial tuist
run: mise install tuist

- name: Test Generate
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_URL: ${{ secrets.MATCH_URL }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
run: fastlane test generate

- name: Build Test
run: fastlane build test

- name: Release Generate
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_URL: ${{ secrets.MATCH_URL }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
run: fastlane release generate

- name: Build Archive
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
run: fastlane build archive

- name: Beta Release
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_API: ${{ secrets.APP_STORE_CONNECT_API }}
run: fastlane beta release
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ generate:
release:
tuist clean
tuist install
# tuist cache
# TUIST_DEVELOPMENT_TEAM=$(DEVELOPMENT_TEAM) tuist generate App
TUIST_DEVELOPMENT_TEAM=$(DEVELOPMENT_TEAM) tuist generate

test:
tuist clean
tuist install
tuist cache
TUIST_DEVELOPMENT_TEAM=$(DEVELOPMENT_TEAM) tuist generate App

# 1) 템플릿을 다운받음
# 2) Private repository로부터 파일 다운로드
# 3) tuist clean -> install -> generate
Expand Down
41 changes: 40 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default_platform(:ios)

platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
lane: release generate do
setup_ci

match(
Expand All @@ -29,7 +29,38 @@ platform :ios do
Dir.chdir("../") do
sh("make release")
end
end

lane: test generate do
setup_ci

match(
type: "appstore",
app_identifier:["com.pokitmons.pokit"],
readonly: true
)

Dir.chdir("../") do
sh("make test")
end
end

lane: build test do
build_app(
workspace: "Pokit.xcworkspace",
scheme: "App",
export_method: "app-store",
export_options: {
method: "app-store",
signingStyle: "manual",
provisioningProfiles: {
"com.pokitmons.pokit" => "match AppStore com.pokitmons.pokit 1721720816"
}
}
)
end

lane: build archive do
api_key = app_store_connect_api_key(
key_id: ENV['APP_STORE_CONNECT_KEY_ID'],
issuer_id: ENV['APP_STORE_CONNECT_ISSUER_ID'],
Expand Down Expand Up @@ -58,6 +89,14 @@ platform :ios do
}
}
)
end

lane: beta release do
api_key = app_store_connect_api_key(
key_id: ENV['APP_STORE_CONNECT_KEY_ID'],
issuer_id: ENV['APP_STORE_CONNECT_ISSUER_ID'],
key_content: ENV['APP_STORE_CONNECT_API']
)

upload_to_testflight(
api_key: api_key,
Expand Down

0 comments on commit 3a26a72

Please sign in to comment.