Skip to content

Commit

Permalink
✨ :: [#62] AppStore 제출Github Action
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Aug 11, 2023
1 parent b333239 commit 45273d4
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 38 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/AppStore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ env:
ENCRYPTED_XCCONFIG_PATH: ${{ 'XCConfig.zip.gpg' }}
DECRYPTED_XCCONFIG_PATH: ${{ 'XCConfig' }}

PROVISION_SECRET: ${{ secrets.PROVISION_SECRET }}
ENCRYPTED_PROVISION_PATH: ${{ 'Tuist/Signing/Dotori.PROD.mobileprovision.gpg' }}
DECRYPTED_PROVISION_PATH: ${{ 'Tuist/Signing/Dotori.PROD.mobileprovision' }}

MASTER_KEY_SECRET: ${{ secrets.MASTER_KEY_SECRET }}
ENCRYPTED_MASTER_KEY_PATH: ${{ 'Tuist/master.key.gpg' }}
DECRYPTED_MASTER_KEY_PATH: ${{ 'Tuist/master.key' }}

FASTLANE_SECRET: ${{ secrets.FASTLANE_SECRET }}
ENCRYPTED_FASTLANE_ENV_PATH: ${{ 'fastlane/.env.default.gpg' }}
DECRYPTED_FASTLANE_ENV_PATH: ${{ 'fastlane/.env.default' }}

APPSTORE_CONNECT_SECRET: ${{ secrets.APPSTORE_CONNECT_SECRET }}
ENCRYPTED_APPSTORE_CONNECT_PATH: ${{ 'fastlane/AppStoreAPIKey.json.gpg' }}
DECRYPTED_APPSTORE_CONNECT_PATH: ${{ 'fastlane/AppStoreAPIKey.json' }}

jobs:
distribute:
name: 🚀 App Store Submission
Expand All @@ -40,13 +47,32 @@ jobs:
unzip XCConfig.zip
# Provisioning Profile
gpg -d -o "$DECRYPTED_PROVISION_PATH" --pinentry-mode=loopback --passphrase "$XCCONFIG_SECRET" "$ENCRYPTED_PROVISION_PATH"
gpg -d -o "$DECRYPTED_PROVISION_PATH" --pinentry-mode=loopback --passphrase "$PROVISION_SECRET" "$ENCRYPTED_PROVISION_PATH"
# master.key
gpg -d -o "$DECRYPTED_MASTER_KEY_PATH" --pinentry-mode=loopback --passphrase "$XCCONFIG_SECRET" "$ENCRYPTED_MASTER_KEY_PATH"
gpg -d -o "$DECRYPTED_MASTER_KEY_PATH" --pinentry-mode=loopback --passphrase "$MASTER_KEY_SECRET" "$ENCRYPTED_MASTER_KEY_PATH"
# fastlane env
gpg -d -o "$DECRYPTED_FASTLANE_ENV_PATH" --pinentry-mode=loopback --passphrase "$XCCONFIG_SECRET" "$ENCRYPTED_FASTLANE_ENV_PATH"
gpg -d -o "$DECRYPTED_FASTLANE_ENV_PATH" --pinentry-mode=loopback --passphrase "$FASTLANE_SECRET" "$ENCRYPTED_FASTLANE_ENV_PATH"
# AppStore Connect API Key
gpg -d -o "$DECRYPTED_APPSTORE_CONNECT_PATH" --pinentry-mode=loopback --passphrase "$APPSTORE_CONNECT_SECRET" "$ENCRYPTED_APPSTORE_CONNECT_PATH"
- name: Install fastlane
run: brew install fastlane

- name: Install tuist
run: curl -Ls https://install.tuist.io | bash

- name: Install dependencies
run: tuist fetch

- name: Project generate
run: TUIST_ENV=CD tuist generate

- name: Update Release Note
run: |
echo "${{ github.event.inputs.changed }}" > fastlane/metadata/ko/release_notes.txt
- name: distribute
run: fastlane release version:"${{ github.event.inputs.version }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fastlane/screenshots/screenshots.html
fastlane/test_output
fastlane/FastlaneRunner
.env.default
AppStoreAPIKey.json

### Git ###
*.orig
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ generate:

ci_generate:
tuist fetch
TUIST_CI=1 tuist generate
TUIST_ENV=CI tuist generate

clean:
rm -rf **/*.xcodeproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ public struct ProjectEnvironment {
public let deploymentTarget: DeploymentTarget
public let platform: Platform
public let baseSetting: SettingsDictionary
public let isCI: Bool
}

public let env = ProjectEnvironment(
name: "Dotori",
organizationName: "com.msg",
deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone, .ipad]),
platform: .iOS,
baseSetting: [:],
isCI: (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false
baseSetting: [:]
)
4 changes: 1 addition & 3 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import Foundation
import ProjectDescription
import ProjectDescriptionHelpers

let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false

let configurations: [Configuration] = .default

let settings: Settings =
Expand All @@ -16,7 +14,7 @@ let settings: Settings =
defaultSettings: .recommended
)

let scripts: [TargetScript] = isCI ? [] : [.swiftFormat, .swiftLint]
let scripts: [TargetScript] = generateEnvironment.scripts

let targets: [Target] = [
.init(
Expand Down
8 changes: 4 additions & 4 deletions Projects/App/Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<dict>
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
<key>CFBundleDisplayName</key>
<string>도토리</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>도토리</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>6</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
4 changes: 1 addition & 3 deletions Projects/Core/Networking/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import ProjectDescriptionHelpers

let name = ModulePaths.Core.Networking.rawValue

let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false

let configurations: [Configuration] = isCI ?
let configurations: [Configuration] = generateEnvironment == .ci ?
.default :
[
.debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: name)),
Expand Down
4 changes: 1 addition & 3 deletions Projects/Domain/MealDomain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import ProjectDescriptionHelpers

let name = ModulePaths.Domain.MealDomain.rawValue

let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false

let configurations: [Configuration] = isCI ?
let configurations: [Configuration] = generateEnvironment == .ci ?
.default :
[
.debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: name)),
Expand Down
24 changes: 24 additions & 0 deletions Tuist/ProjectDescriptionHelpers/Enum/GenerateEnvironment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import ConfigurationPlugin
import Foundation
import ProjectDescription

public enum GenerateEnvironment: String {
case ci = "CI"
case cd = "CD"
case dev = "DEV"
}

let environment = ProcessInfo.processInfo.environment["TUIST_ENV"] ?? ""
public let generateEnvironment = GenerateEnvironment(rawValue: environment) ?? .dev

public extension GenerateEnvironment {
var scripts: [TargetScript] {
switch self {
case .ci, .cd:
return []

case .dev:
return [.swiftFormat, .swiftLint]
}
}
}
4 changes: 1 addition & 3 deletions Tuist/ProjectDescriptionHelpers/Project+Template.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import EnvironmentPlugin
import Foundation
import ProjectDescription

let isCI = (ProcessInfo.processInfo.environment["TUIST_CI"] ?? "0") == "1" ? true : false

public enum MicroFeatureTarget {
case interface
case testing
Expand Down Expand Up @@ -36,7 +34,7 @@ public extension Project {
configurations: [Configuration] = [],
resourceSynthesizers: [ResourceSynthesizer] = .default
) -> Project {
let scripts: [TargetScript] = isCI ? [] : [.swiftFormat, .swiftLint]
let scripts: [TargetScript] = generateEnvironment.scripts
let ldFlagsSettings: SettingsDictionary = product == .framework ?
["OTHER_LDFLAGS": .string("$(inherited) -all_load")] :
["OTHER_LDFLAGS": .string("$(inherited)")]
Expand Down
2 changes: 1 addition & 1 deletion Tuist/ProjectDescriptionHelpers/Target/TargetSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct TargetSpec: Configurable {
copyFiles: [CopyFilesAction]? = nil,
headers: Headers? = nil,
entitlements: Path? = nil,
scripts: [TargetScript] = env.isCI ? [] : [.swiftFormat, .swiftLint],
scripts: [TargetScript] = generateEnvironment.scripts,
dependencies: [TargetDependency] = [],
settings: Settings? = nil,
coreDataModels: [CoreDataModel] = [],
Expand Down
Binary file added fastlane/AppStoreAPIKey.json.gpg
Binary file not shown.
17 changes: 12 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,27 @@ platform :ios do
desc "Push a new release build to the App Store"
lane :release do |options|
version = options[:version]
set_info_plist_value(path: "./Projects/App/Support/Info.plist", key: "CFBundleVersion", value: version)

build_number = get_info_plist_value(path: "./Projects/App/Support/Info.plist", key: "CFBundleVersion")
set_info_plist_value(path: "./Projects/App/Support/Info.plist", key: "CFBundleVersion", value: "#{build_number.to_i + 1}")
set_info_plist_value(path: "./Projects/App/Support/Info.plist", key: "CFBundleShortVersionString", value: version)
build_app(scheme: "Dotori-PROD")
upload_to_app_store(
app_version: version,
submit_for_review: true,
force: true,
automatic_release: true,
skip_metadata: false
skip_metadata: false,
api_key_path: "fastlane/AppStoreAPIKey.json",
precheck_include_in_app_purchases: false,
submission_information: {
add_id_info_uses_idfa: false
}
)
discord_notifier(
webhook_url: "https://",
title: "🚀 도토리 iOS CD 성공 🚀",
image_url: "https://github.com/Team-Ampersand/Dotori-iOS/assets/74440939/5bcfc67c-37b2-42f6-8cef-7b544b0a5606",
webhook_url: "https://discord.com/api/webhooks/1139535875546566686/HmyeqwRhRPcx6sQOLu7KTQD-RsNwBY-3G36f8sTizjx3FA1eiLuJgODcBVIEhG7gZb3z",
title: "🚀 도토리 iOS CD 성공",
thumbnail_url: "https://github.com/Team-Ampersand/Dotori-iOS/assets/74440939/5bcfc67c-37b2-42f6-8cef-7b544b0a5606",
description: "도토리 iOS #{version}을 앱스토어에 성공적으로 배포하였습니다 !"
)
set_github_release(
Expand Down
8 changes: 0 additions & 8 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do

Push a new release build to the App Store

### ios tt

```sh
[bundle exec] fastlane ios tt
```



----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
Expand Down
2 changes: 1 addition & 1 deletion fastlane/metadata/ko/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
공유하기 버튼을 누르고 도토리 앱을 선택해서 바로 기상음악을 신청할 수 있습니다!
홈화면에서 작은 성능개선이 있었습니다.
Binary file modified graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 45273d4

Please sign in to comment.