From 8024b53d90e00defabc0db1c074605addd4d3295 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Sat, 22 Aug 2020 20:55:49 +0900 Subject: [PATCH 01/16] wip --- .env.example | 2 ++ fastlane/Fastfile | 38 ++++++++++++++++++++++++++++++++------ fastlane/Matchfile | 8 ++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 fastlane/Matchfile diff --git a/.env.example b/.env.example index aa08f71..53e330c 100644 --- a/.env.example +++ b/.env.example @@ -5,3 +5,5 @@ FIREBASE_APP_ID_IOS= FIREBASE_CLI_TOKEN= IPA_PATH= RELEASE_NOTE= +MATCH_GIT_URL= +CODE_SIGNING_IDENTITY= \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index c60ac4a..0715d03 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,13 +18,39 @@ default_platform(:ios) platform :ios do desc 'Distribute iOS App' lane :distribute_app do + if is_ci? + create_keychain( + name: ENV['MATCH_KEYCHAIN_NAME'], + password: ENV['MATCH_KEYCHAIN_PASSWORD'], + default_keychain: true, + unlock: true, + timeout: 1800, + lock_when_sleeps: false + ) + end + match( + readonly: is_ci, + keychain_name: ENV['MATCH_KEYCHAIN_NAME'], + keychain_password: ENV['MATCH_KEYCHAIN_PASSWORD'] + ) + update_project_provisioning( + xcodeproj: "{Template}.xcodeproj", + profile: ENV["sigh_{BUNDLE_IDENTIFIER}_development_profile-path"], + code_signing_identity: ENV['CODE_SIGNING_IDENTITY'] + ) + build_app( + scheme: "Sample", + export_options: { + method: "development" + } + ) firebase_app_distribution( - app: ENV['FIREBASE_APP_ID_IOS'], - groups: "gotties", - ipa_path: ENV['IPA_PATH'], - release_notes: ENV['RELEASE_NOTE'], - firebase_cli_path: "./node_modules/firebase-tools/lib/bin/firebase.js", - firebase_cli_token: ENV['FIREBASE_CLI_TOKEN'], + app: ENV['FIREBASE_APP_ID_IOS'], + groups: "gotties", + ipa_path: ENV['IPA_PATH'], + release_notes: ENV['RELEASE_NOTE'], + firebase_cli_path: "#{Dir.pwd}/../node_modules/firebase-tools/lib/bin/firebase.js", + firebase_cli_token: ENV['FIREBASE_CLI_TOKEN'], ) end diff --git a/fastlane/Matchfile b/fastlane/Matchfile new file mode 100644 index 0000000..81acd4d --- /dev/null +++ b/fastlane/Matchfile @@ -0,0 +1,8 @@ +require 'dotenv' + +# format: https://{Personal Access Token}:x-oauth-basic@github.com/{Organization}/{Repo name} +git_url(ENV['MATCH_GIT_URL']) + +storage_mode("git") + +type("development") # The default type, can be: appstore, adhoc, enterprise or development From 33fa33a38858b72101f4842e4b66e58b7833d433 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Mon, 31 Aug 2020 02:29:06 +0900 Subject: [PATCH 02/16] add env --- .env.example | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env.example b/.env.example index 53e330c..da4e0c1 100644 --- a/.env.example +++ b/.env.example @@ -6,4 +6,6 @@ FIREBASE_CLI_TOKEN= IPA_PATH= RELEASE_NOTE= MATCH_GIT_URL= +MATCH_KEYCHAIN_NAME= +MATCH_KEYCHAIN_PASSWORD= CODE_SIGNING_IDENTITY= \ No newline at end of file From 930c70078929c0fb705eba0c029e661b18c72fd7 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Mon, 31 Aug 2020 02:35:17 +0900 Subject: [PATCH 03/16] make workflow --- .github/workflows/main.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4ea04d0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,49 @@ +# This workflow uses in Template repository only. + +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + distribute: + runs-on: macOS-latest + env: + MINT_PATH: mint/lib + MINT_LINK_PATH: mint/bin + + steps: + - uses: actions/checkout@v2 + - name: Cache Gem + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile') }} + restore-keys: | + ${{ runner.os }}-gem- + - name: Cache Mint + uses: actions/cache@v2 + with: + path: mint + key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} + restore-keys: | + ${{ runner.os }}-mint- + - name: Cache npm + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-mint-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Init + run: make init + - name: XcodeGen generate + run: xcodegen + - name: Build & Distribute + run: bundle exec fastlane distribute + env: + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} From 1229d485d9d769b2d0ff0ad5fa39db3deb8b19b8 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 11:30:33 +0900 Subject: [PATCH 04/16] install rbenv in workflow --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ea04d0..c7060c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,8 @@ jobs: key: ${{ runner.os }}-mint-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- + - name: Install rbenv + run: brew install rbenv - name: Init run: make init - name: XcodeGen generate From 8108c709085143bbe88524c0b3c24508c286417b Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 11:35:47 +0900 Subject: [PATCH 05/16] install ruby --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7060c2..7556858 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,8 +38,10 @@ jobs: key: ${{ runner.os }}-mint-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - name: Install rbenv - run: brew install rbenv + - name: Install rbenv & Ruby + run: | + brew install rbenv + rbenv install 2.7.1 - name: Init run: make init - name: XcodeGen generate From 660e50dc336348af76903432daf52cfff2176b0a Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:00:07 +0900 Subject: [PATCH 06/16] update --- .env.example | 3 +-- .github/workflows/main.yml | 11 ++++++++++- fastlane/Fastfile | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index da4e0c1..c0b4620 100644 --- a/.env.example +++ b/.env.example @@ -3,9 +3,8 @@ ITC_TEAM_ID= TEAM_ID= FIREBASE_APP_ID_IOS= FIREBASE_CLI_TOKEN= -IPA_PATH= RELEASE_NOTE= MATCH_GIT_URL= MATCH_KEYCHAIN_NAME= MATCH_KEYCHAIN_PASSWORD= -CODE_SIGNING_IDENTITY= \ No newline at end of file +CODE_SIGNING_IDENTITY= diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7556858..8edba29 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,5 +49,14 @@ jobs: - name: Build & Distribute run: bundle exec fastlane distribute env: + APPLE_ID: ${{ secrets.APPLE_ID }} + ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }} + TEAM_ID: ${{ secrets.TEAM_ID }} + FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }} + FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + CODE_SIGNING_IDENTITY: ${{ secrets.CODE_SIGNING_IDENTITY }} + RELEASE_NOTE: test MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 0715d03..4167238 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -47,7 +47,7 @@ platform :ios do firebase_app_distribution( app: ENV['FIREBASE_APP_ID_IOS'], groups: "gotties", - ipa_path: ENV['IPA_PATH'], + ipa_path: "#{Dir.pwd}/../{Template}.ipa", release_notes: ENV['RELEASE_NOTE'], firebase_cli_path: "#{Dir.pwd}/../node_modules/firebase-tools/lib/bin/firebase.js", firebase_cli_token: ENV['FIREBASE_CLI_TOKEN'], From 34c5559fd6c5b951508c26abcecc90057eeb2275 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:05:35 +0900 Subject: [PATCH 07/16] use masa-iwasaki/setup-rbenv@v1 --- .github/workflows/main.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8edba29..081c4c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,10 +38,18 @@ jobs: key: ${{ runner.os }}-mint-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- + - name: Cache rbenv + uses: actions/cache@v2 + with: + path: /home/runner/.rbenv + key: ${{ runner.os }}-rbenv-${{ hashFiles('**/.ruby-version') }} + restore-keys: | + {{ runner.os }}-rbenv- - name: Install rbenv & Ruby + uses: masa-iwasaki/setup-rbenv@v1 run: | - brew install rbenv - rbenv install 2.7.1 + eval "$(rbenv init -)" + rbenv install -s `cat .ruby-version` - name: Init run: make init - name: XcodeGen generate From 719ec43936b7efb1e39d3fe184e78ff56c195355 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:07:20 +0900 Subject: [PATCH 08/16] fix --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 081c4c1..0a9db13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,8 +45,8 @@ jobs: key: ${{ runner.os }}-rbenv-${{ hashFiles('**/.ruby-version') }} restore-keys: | {{ runner.os }}-rbenv- + - uses: masa-iwasaki/setup-rbenv@v1 - name: Install rbenv & Ruby - uses: masa-iwasaki/setup-rbenv@v1 run: | eval "$(rbenv init -)" rbenv install -s `cat .ruby-version` From 77a729b8b7111d42ae5afbf043213cc8f5d0c6ed Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:09:56 +0900 Subject: [PATCH 09/16] remove masa-iwasaki/setup-rbenv@v1 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a9db13..90f5e3f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,9 +45,9 @@ jobs: key: ${{ runner.os }}-rbenv-${{ hashFiles('**/.ruby-version') }} restore-keys: | {{ runner.os }}-rbenv- - - uses: masa-iwasaki/setup-rbenv@v1 - name: Install rbenv & Ruby run: | + brew install rbenv eval "$(rbenv init -)" rbenv install -s `cat .ruby-version` - name: Init From dce858e1a0ad748e32049e9d99314281b6ca84a3 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:21:59 +0900 Subject: [PATCH 10/16] update bootstrap --- scripts/bootstrap.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 5d3bbd7..7447ee4 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -58,10 +58,15 @@ replace_bundle_identifier() { } main() { - check_depends + project_name=$1 + bundle_identifier=$2 + is_ci=$3 + if ! $is_ci; then + check_depends + fi dependencies - replace_project_name $1 - replace_bundle_identifier $2 + replace_project_name $project_name + replace_bundle_identifier $bundle_identifier } main $1 $2 From 393d859d92c2cdb11dd187aea122ede7dd42f3b4 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:23:11 +0900 Subject: [PATCH 11/16] upate workflow --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90f5e3f..57921c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,7 @@ jobs: eval "$(rbenv init -)" rbenv install -s `cat .ruby-version` - name: Init - run: make init + run: ./scripts/bootstrap.sh Test com.example.template.Template true - name: XcodeGen generate run: xcodegen - name: Build & Distribute From 7a49faaf5265bb5a2b30961bc778e720acee51ee Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:27:07 +0900 Subject: [PATCH 12/16] remove install rbenv, ruby --- .github/workflows/main.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57921c0..05a9ada 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,11 +45,6 @@ jobs: key: ${{ runner.os }}-rbenv-${{ hashFiles('**/.ruby-version') }} restore-keys: | {{ runner.os }}-rbenv- - - name: Install rbenv & Ruby - run: | - brew install rbenv - eval "$(rbenv init -)" - rbenv install -s `cat .ruby-version` - name: Init run: ./scripts/bootstrap.sh Test com.example.template.Template true - name: XcodeGen generate From 55425ef1d02ed64fc1f10df6d67640ba669aa5c0 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Tue, 1 Sep 2020 12:42:04 +0900 Subject: [PATCH 13/16] mint run xcodegen --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 05a9ada..5cfe5a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,7 +48,7 @@ jobs: - name: Init run: ./scripts/bootstrap.sh Test com.example.template.Template true - name: XcodeGen generate - run: xcodegen + run: mint run xcodegen - name: Build & Distribute run: bundle exec fastlane distribute env: From 31ad18d49bb04462ad46f25b8a2799733040764c Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Wed, 2 Sep 2020 01:07:41 +0900 Subject: [PATCH 14/16] remove ruby version --- Gemfile.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2a7efdf..926165d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -177,8 +177,5 @@ DEPENDENCIES fastlane fastlane-plugin-firebase_app_distribution -RUBY VERSION - ruby 2.7.1p83 - BUNDLED WITH 2.1.4 From a3b948fa0317e47952938be3bf09604c7bcabe82 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Wed, 2 Sep 2020 09:35:36 +0900 Subject: [PATCH 15/16] remove ruby version --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index ed91cc9..269a6f7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ # frozen_string_literal: true source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } -ruby '2.7.1' gem 'fastlane' From 269984625746a08ab26cdf0fdb7a50db852be6c7 Mon Sep 17 00:00:00 2001 From: ryoya ito <110ryoya@gmail.com> Date: Wed, 2 Sep 2020 10:23:59 +0900 Subject: [PATCH 16/16] distribute_app --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5cfe5a3..cc9951c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,7 +50,7 @@ jobs: - name: XcodeGen generate run: mint run xcodegen - name: Build & Distribute - run: bundle exec fastlane distribute + run: bundle exec fastlane distribute_app env: APPLE_ID: ${{ secrets.APPLE_ID }} ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}