From fe03c40f05ae931b338284fb1f85788725072710 Mon Sep 17 00:00:00 2001 From: Alexey Korolev Date: Thu, 8 Oct 2020 11:29:56 +0300 Subject: [PATCH] Configure using AppStore API for fastlane and bitrise (#153) --- CHANGELOG.md | 4 ++++ README.md | 2 +- hooks/post_gen_project.sh | 1 + {{ cookiecutter.name }}/README.md | 18 +++++++++++++----- {{ cookiecutter.name }}/bitrise.yml | 10 ++++++++++ {{ cookiecutter.name }}/fastlane/Fastfile | 6 +++++- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12043b3..9680ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.5] - 2020-10-08 +### Changed +- Изменил конфигурации bitrise и fastlane на использование [AppStore API](https://docs.fastlane.tools/app-store-connect-api/) + ## [1.2.4] - 2020-10-05 ### Changed - Обновил AppIcon утилиту до 1.0.5 версии, так как предыдущая не собиралась на Swift 5.3 diff --git a/README.md b/README.md index ab48afd..f548208 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # My iOS app template -[![Build Status](https://travis-ci.com/alphatroya/swift-project-template.svg?branch=master)](https://travis-ci.com/alphatroya/swift-project-template) +![Build project and run tests](https://github.com/alphatroya/swift-project-template/workflows/Build%20project%20and%20run%20tests/badge.svg) ## Description diff --git a/hooks/post_gen_project.sh b/hooks/post_gen_project.sh index 978c6b9..08ce6aa 100644 --- a/hooks/post_gen_project.sh +++ b/hooks/post_gen_project.sh @@ -10,6 +10,7 @@ make swiftgen curl -L 'https://www.gitignore.io/api/swift,macos,fastlane' > .gitignore echo '.idea' >> .gitignore echo 'Templates' >> .gitignore +echo 'fastlane/api-key.json' >> .gitignore make icon diff --git a/{{ cookiecutter.name }}/README.md b/{{ cookiecutter.name }}/README.md index 4a59039..8013e92 100644 --- a/{{ cookiecutter.name }}/README.md +++ b/{{ cookiecutter.name }}/README.md @@ -1,6 +1,6 @@ # {{ cookiecutter.name }} -/// A place for CI status badge + ## Bootstrapping development environment ```sh @@ -9,19 +9,27 @@ make bootstrap ## Bitrise CI configuration -Paste [bitrise.yml](https://github.com/alphatroya/swift-project-template/wiki/Bitrise%20config) content in the bitrise project settings page. +Configure Bitrise for using stored in repository `bitrise.yml` file. -Also, some environment parameters need to be set: +Also, some secret environment parameters need to be set: - `$MATCH_PASSWORD`: password to the [match](https://docs.fastlane.tools/actions/match/) repo -- `$FASTLANE_PASSWORD`: AppleID password +- `$APPSTORE_API_KEY_ENCRYPT_PWD`: password for the encrypted `api-key.json` file ## Template info The project was generated using the [cookiecutter tool](https://github.com/audreyr/cookiecutter) and [this](https://github.com/alphatroya/swift-project-template) swift template. -Template version: 1.2.4 +Template version: 1.2.5 + +## AppStore credentials + +Interaction with AppStore needs credentials. This project uses the official [AppStore API](https://docs.fastlane.tools/app-store-connect-api). For proper project deployment process, the project owner needs to create the `fastlane/app-key.json` file with access keys and encrypt by gpg tool with a strong password. +```sh +gpg -c fastlane/api-key.json +``` +The resulted encrypted file should be committed to the repository. ## Copyright diff --git a/{{ cookiecutter.name }}/bitrise.yml b/{{ cookiecutter.name }}/bitrise.yml index d35057c..383200b 100644 --- a/{{ cookiecutter.name }}/bitrise.yml +++ b/{{ cookiecutter.name }}/bitrise.yml @@ -20,6 +20,11 @@ workflows: - activate-ssh-key: {% raw -%}run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'{%- endraw %} - git-clone: {} + - decrypt-file@0: + inputs: + - encrypted_file_path: fastlane/api-key.json.gpg + - output_file_path: fastlane/api-key.json + - decrypt_passphrase: $APPSTORE_API_KEY_ENCRYPT_PWD - cache-pull: {} - bitrise-step-install-bundler: {} - fastlane: @@ -78,6 +83,11 @@ workflows: - activate-ssh-key: {% raw -%}run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'{%- endraw %} - git-clone: {} + - decrypt-file@0: + inputs: + - encrypted_file_path: fastlane/api-key.json.gpg + - output_file_path: fastlane/api-key.json + - decrypt_passphrase: $APPSTORE_API_KEY_ENCRYPT_PWD - cache-pull: {} - bitrise-step-install-bundler: {} - fastlane: diff --git a/{{ cookiecutter.name }}/fastlane/Fastfile b/{{ cookiecutter.name }}/fastlane/Fastfile index 485988c..f4093b2 100644 --- a/{{ cookiecutter.name }}/fastlane/Fastfile +++ b/{{ cookiecutter.name }}/fastlane/Fastfile @@ -15,10 +15,12 @@ platform :ios do match( type: "development", clone_branch_directly: false, + api_key_path: "fastlane/api-key.json", ) match( type: "appstore", clone_branch_directly: false, + api_key_path: "fastlane/api-key.json", ) end @@ -29,7 +31,8 @@ platform :ios do ) match( type: "development", - force_for_new_devices: true + force_for_new_devices: true, + api_key_path: "fastlane/api-key.json", ) end @@ -61,6 +64,7 @@ platform :ios do ) pilot( + api_key_path: "fastlane/api-key.json", distribute_external: true, beta_app_feedback_email: '{{ cookiecutter.apple_id }}', beta_app_description: 'Beta build for testing',