Skip to content

Commit

Permalink
Merge pull request #34 from tarappo/upload_test_flight
Browse files Browse the repository at this point in the history
Test Flightへのアップロードのテスト
  • Loading branch information
tarappo authored Jul 22, 2024
2 parents 57f5d1b + 194f49a commit a01b46d
Show file tree
Hide file tree
Showing 31 changed files with 134 additions and 84 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ jobs:
build:
runs-on: macos-latest
timeout-minutes: 40
env:
DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer"
steps:
- uses: actions/checkout@v4
- name: archive
run: |
xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug
- name: ipa
- name: upload testflight
env:
AUTHKEY_P8_BASE64: ${{ secrets.AUTHKEY_P8_BASE64 }}
ISSUER_ID: ${{ secrets.ISSUER_ID }}
KEY_ID: ${{ secrets.KEY_ID }}
run: |
echo $AUTHKEY_P8_BASE64 | base64 -d > $PWD/Authkey.p8
xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptions.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8
xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptionsTestFlight.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8
test:
runs-on: macos-latest
Expand Down
25 changes: 25 additions & 0 deletions ExportOptionsTestFlight.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>upload</string>
<key>manageAppVersionAndBuildNumber</key>
<true/>
<key>method</key>
<string>app-store-connect</string>
<key>provisioningProfiles</key>
<dict>
<key>com.tarappo.uitest</key>
<string>UI Test Sample</string>
</dict>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>BY773RCU69</string>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ mainは常に問題ないコードが入っている前提です。
- 特定タイミングになったらtagをきってリリース


# CI/CDサービスごとの実行内容
すべてのCI/CDサービスでTest Flightへのアップロードをおこなうのは微妙なので次のように分けています。

|CI/CDサービス|トリガー|内容|
|:----------|:------|:---|
|GitHub Actions|PR|TestFlightへアップロード|
|CircleCI|PR|アプリのビルドと保存|
|Bitrise|PR|アプリのビルドと保存|



## CI Badge
Badgeが利用できるCIサービスについては以下に全て貼ります。

Expand Down
67 changes: 67 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
format_version: "13"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
workflows:
build:
summary: Run your Xcode tests and create an IPA file to install your app on a device or share it with your team.
description: The workflow will first clone your Git repository, cache and install your project's dependencies if any, run your Xcode tests, export an IPA file from the project and save it.
steps:
- git-clone@8: {}
- cache-pull@2: {}
- script@1:
inputs:
- script_file_path: null
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug
title: Archiveの作成
- script@1:
inputs:
- script_file_path: null
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
echo "${AUTHKEY_P8_BASE64}" | base64 -d > $PWD/Authkey.p8
xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./output -exportOptionsPlist ./ExportOptions.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8
title: Archiveからipaを生成
- cache-push@2: {}
- deploy-to-bitrise-io@2:
inputs:
- deploy_path: ./output
meta:
bitrise.io:
stack: osx-xcode-15.4.x
machine_type_id: g2-m1.4core
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: ci-sample.xcworkspace
- opts:
is_expand: false
BITRISE_SCHEME: ci-sample
- opts:
is_expand: false
BITRISE_DISTRIBUTION_METHOD: ad-hoc
trigger_map:
- pull_request_target_branch:
regex: main
type: pull_request
workflow: build
- push_branch: main
type: push
workflow: build
2 changes: 2 additions & 0 deletions ci-sample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>
7 changes: 0 additions & 7 deletions fastlane/Deliverfile

This file was deleted.

72 changes: 25 additions & 47 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
skip_docs
opt_out_usage

default_platform :ios

platform :ios do
keychain_name = "ios-build.keychain"
keychain_password = SecureRandom.base64
build_number = ENV["BUILD_NUMBER"] ||= "0"

desc "run test"
lane :test do
run_tests(
output_directory: "./test_result"
)
end


lane :upload_ipa_for_testflight do
key_id = ENV["KEY_ID"]
issuer_id = ENV["ISSUER_ID"]
ipa_file_path = ENV["IPA_FILE_PATH"]
auth_key_p8_path = ENV["AUTHKEY_P8_FILE_PATH"]

app_store_connect_api_key(
key_id: key_id,
issuer_id: issuer_id,
key_filepath: auth_key_p8_path,
duration: 1200,
in_house: false
)

upload_to_testflight(
ipa: ipa_file_path,
skip_submission: true,
)
end

desc "build Simulator File"
lane :build_for_simulator do
build_app(
Expand All @@ -24,47 +45,4 @@ platform :ios do
end


lane :build_debug_without_match do
clean_build_artifacts
increment_build_number(
build_number: "0." + ENV["BUILD_NUMBER"]
)

build(type: "Debug")
end

lane :build_debug do
match(type: "development", readonly: is_ci)

clean_build_artifacts
increment_build_number(
build_number: "0." + ENV["BUILD_NUMBER"]
)

build(type: "Debug")
end

lane :build_release do
match(type: "appstore", readonly: is_ci)

clean_build_artifacts
increment_build_number(
build_number: "1." + ENV["BUILD_NUMBER"]
)

build(type: "Release")
end


private_lane :build do |options|
configuration = options[:type]
export_method = configuration == "Release" ? "appstore" : "development"

gym(
project: "./ci-sample.xcodeproj",
scheme: "ci-sample",
configuration: configuration,
export_method: export_method
)
end
end
4 changes: 0 additions & 4 deletions fastlane/Matchfile

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/copyright.txt

This file was deleted.

2 changes: 0 additions & 2 deletions fastlane/metadata/en-US/description.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/keywords.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/marketing_url.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/name.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/privacy_url.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/promotional_text.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/release_notes.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/subtitle.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/en-US/support_url.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/primary_category.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/primary_first_sub_category.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/primary_second_sub_category.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/demo_password.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/demo_user.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/email_address.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/first_name.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/last_name.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/notes.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/review_information/phone_number.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/secondary_category.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/secondary_first_sub_category.txt

This file was deleted.

1 change: 0 additions & 1 deletion fastlane/metadata/secondary_second_sub_category.txt

This file was deleted.

0 comments on commit a01b46d

Please sign in to comment.