From 157f33618400b8ced5f6848f0f8e31be138b4500 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 4 Oct 2022 08:17:30 +0200 Subject: [PATCH] Embed fastlane scripts locally Drop submodule. --- .gitmodules | 3 - Submodules/fastlane-ci-templates | 1 - Submodules/fastlane-ci-templates/.gitignore | 9 + Submodules/fastlane-ci-templates/Gemfile | 6 + Submodules/fastlane-ci-templates/Gemfile.lock | 218 ++++++++++++++++++ Submodules/fastlane-ci-templates/LICENSE | 21 ++ Submodules/fastlane-ci-templates/README.md | 36 +++ .../ci/build-changelog.sh | 10 + .../fastlane-ci-templates/ci/build-number.sh | 2 + .../ci/copy-release-notes.sh | 16 ++ .../ci/latest-changelog.sh | 14 ++ .../fastlane-ci-templates/ci/push-refs.sh | 14 ++ .../fastlane-ci-templates/ci/set-build.sh | 2 + .../fastlane-ci-templates/ci/set-version.sh | 2 + .../fastlane-ci-templates/ci/strip-issues.sh | 2 + .../ci/update-asc-metadata.sh | 3 + .../ci/update-asc-screenshots.sh | 3 + .../ci/update-release-notes.sh | 7 + .../ci/version-number.sh | 2 + Submodules/fastlane-ci-templates/env/.env | 3 + .../fastlane-ci-templates/env/.env.beta | 7 + Submodules/fastlane-ci-templates/env/.env.ios | 7 + Submodules/fastlane-ci-templates/env/.env.mac | 8 + .../fastlane/Fastfile.include | 111 +++++++++ .../fastlane-ci-templates/fastlane/Gymfile | 16 ++ ci | 1 - ci/build-changelog.sh | 10 + ci/build-number.sh | 2 + ci/copy-release-notes.sh | 16 ++ ci/latest-changelog.sh | 14 ++ ci/push-refs.sh | 14 ++ ci/set-build.sh | 2 + ci/set-version.sh | 2 + ci/strip-issues.sh | 2 + ci/update-asc-metadata.sh | 3 + ci/update-asc-screenshots.sh | 3 + ci/update-release-notes.sh | 7 + ci/version-number.sh | 2 + fastlane/Fastfile | 2 +- fastlane/Fastfile.include | 111 +++++++++ 40 files changed, 708 insertions(+), 6 deletions(-) delete mode 160000 Submodules/fastlane-ci-templates create mode 100644 Submodules/fastlane-ci-templates/.gitignore create mode 100644 Submodules/fastlane-ci-templates/Gemfile create mode 100644 Submodules/fastlane-ci-templates/Gemfile.lock create mode 100644 Submodules/fastlane-ci-templates/LICENSE create mode 100644 Submodules/fastlane-ci-templates/README.md create mode 100755 Submodules/fastlane-ci-templates/ci/build-changelog.sh create mode 100755 Submodules/fastlane-ci-templates/ci/build-number.sh create mode 100755 Submodules/fastlane-ci-templates/ci/copy-release-notes.sh create mode 100755 Submodules/fastlane-ci-templates/ci/latest-changelog.sh create mode 100755 Submodules/fastlane-ci-templates/ci/push-refs.sh create mode 100755 Submodules/fastlane-ci-templates/ci/set-build.sh create mode 100755 Submodules/fastlane-ci-templates/ci/set-version.sh create mode 100755 Submodules/fastlane-ci-templates/ci/strip-issues.sh create mode 100755 Submodules/fastlane-ci-templates/ci/update-asc-metadata.sh create mode 100755 Submodules/fastlane-ci-templates/ci/update-asc-screenshots.sh create mode 100755 Submodules/fastlane-ci-templates/ci/update-release-notes.sh create mode 100755 Submodules/fastlane-ci-templates/ci/version-number.sh create mode 100644 Submodules/fastlane-ci-templates/env/.env create mode 100644 Submodules/fastlane-ci-templates/env/.env.beta create mode 100644 Submodules/fastlane-ci-templates/env/.env.ios create mode 100644 Submodules/fastlane-ci-templates/env/.env.mac create mode 100644 Submodules/fastlane-ci-templates/fastlane/Fastfile.include create mode 100644 Submodules/fastlane-ci-templates/fastlane/Gymfile delete mode 120000 ci create mode 100755 ci/build-changelog.sh create mode 100755 ci/build-number.sh create mode 100755 ci/copy-release-notes.sh create mode 100755 ci/latest-changelog.sh create mode 100755 ci/push-refs.sh create mode 100755 ci/set-build.sh create mode 100755 ci/set-version.sh create mode 100755 ci/strip-issues.sh create mode 100755 ci/update-asc-metadata.sh create mode 100755 ci/update-asc-screenshots.sh create mode 100755 ci/update-release-notes.sh create mode 100755 ci/version-number.sh create mode 100644 fastlane/Fastfile.include diff --git a/.gitmodules b/.gitmodules index 3a539776..7ce4464a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "Submodules/fastlane-ci-templates"] - path = Submodules/fastlane-ci-templates - url = https://github.com/keeshux/fastlane-ci-templates [submodule "PassepartoutLibrary/Sources/PassepartoutServices/API"] path = PassepartoutLibrary/Sources/PassepartoutServices/API url = https://github.com/passepartoutvpn/api diff --git a/Submodules/fastlane-ci-templates b/Submodules/fastlane-ci-templates deleted file mode 160000 index 7cba3987..00000000 --- a/Submodules/fastlane-ci-templates +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7cba3987d5e2a36ac06278ab570f8d9fbca5af5a diff --git a/Submodules/fastlane-ci-templates/.gitignore b/Submodules/fastlane-ci-templates/.gitignore new file mode 100644 index 00000000..b792c315 --- /dev/null +++ b/Submodules/fastlane-ci-templates/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +*.swp +*.o +*.pbxuser +*.xcworkspace/xcuserdata +*.xcodeproj/project.xcworkspace +*.xcodeproj/xcuserdata +Pods +.env.secret* diff --git a/Submodules/fastlane-ci-templates/Gemfile b/Submodules/fastlane-ci-templates/Gemfile new file mode 100644 index 00000000..cdd3a6b3 --- /dev/null +++ b/Submodules/fastlane-ci-templates/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Submodules/fastlane-ci-templates/Gemfile.lock b/Submodules/fastlane-ci-templates/Gemfile.lock new file mode 100644 index 00000000..1110d772 --- /dev/null +++ b/Submodules/fastlane-ci-templates/Gemfile.lock @@ -0,0 +1,218 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.641.0) + aws-sdk-core (3.158.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.58.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.4) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.93.0) + faraday (1.10.2) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.210.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.29.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-core (0.9.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.15.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-playcustomapp_v1 (0.11.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-storage_v1 (0.19.0) + google-apis-core (>= 0.9.0, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.3.0) + google-cloud-storage (1.43.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.19.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.2.0) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.1) + json (2.6.2) + jwt (2.5.0) + memoist (0.16.2) + mini_magick (4.11.0) + mini_mime (1.1.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + optparse (0.1.1) + os (1.1.4) + plist (3.6.0) + public_suffix (5.0.0) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.17.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + webrick (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.22.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.3.11 diff --git a/Submodules/fastlane-ci-templates/LICENSE b/Submodules/fastlane-ci-templates/LICENSE new file mode 100644 index 00000000..4d538944 --- /dev/null +++ b/Submodules/fastlane-ci-templates/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Davide De Rosa + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Submodules/fastlane-ci-templates/README.md b/Submodules/fastlane-ci-templates/README.md new file mode 100644 index 00000000..c79e39bd --- /dev/null +++ b/Submodules/fastlane-ci-templates/README.md @@ -0,0 +1,36 @@ +## Installation + +- Copy or clone to any subdirectory +- Import `include/Fastfile.include` from `fastlane/Fastfile` +- Copy `templates/fastlane/*` to `fastlane` +- Copy everything in `templates` except `.env*` to local `templates` + +### Environment + +- Copy `templates/.env*` to root +- Rename `.env.template.secret*` to `.env.secret*` +- Edit files accordingly +- Make sure to add `.env.secret*` to `.gitignore` + +## Usage + +### Input + +- Environment: `.env*` in root +- App description: `templates/DESCRIPTION.md` +- App changelog: `templates/CHANGELOG.md` +- App beta feedback e-mail: `templates/beta-feedback.txt` + +### Output + +- Intermediate products: `build/(ios|mac)/(dev|beta)` +- IPA: `dist/(ios|mac)/(dev|beta)` + +## Extra + +For AppCenter support (`dev-*` scripts), append this to `Gemfile`: + +``` +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) +``` diff --git a/Submodules/fastlane-ci-templates/ci/build-changelog.sh b/Submodules/fastlane-ci-templates/ci/build-changelog.sh new file mode 100755 index 00000000..8065ebe2 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/build-changelog.sh @@ -0,0 +1,10 @@ +#!/bin/bash +. .env +. .env.$1 + +RELEASE_NOTES="$DELIVER_METADATA_PATH/en-US/release_notes.txt" +if [[ -n $CHANGELOG_PREFACE ]]; then + echo "$CHANGELOG_PREFACE" + echo +fi +cat $RELEASE_NOTES diff --git a/Submodules/fastlane-ci-templates/ci/build-number.sh b/Submodules/fastlane-ci-templates/ci/build-number.sh new file mode 100755 index 00000000..5638232f --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/build-number.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane --env $1 get_build_number_unix 2>/dev/null | grep "Build: " | sed -E "s/^.*Build: (.*)$/\1/g" diff --git a/Submodules/fastlane-ci-templates/ci/copy-release-notes.sh b/Submodules/fastlane-ci-templates/ci/copy-release-notes.sh new file mode 100755 index 00000000..29ff3da7 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/copy-release-notes.sh @@ -0,0 +1,16 @@ +#!/bin/bash +. .env.$1 + +RELEASE_NOTES="release_notes" +RX='^[a-z]{2}(\-[A-z]+)?$' +cd "$DELIVER_METADATA_PATH" +for LANG in `ls -d *`; do + if [[ $LANG == "en-US" ]]; then + continue + fi + if [[ ! $LANG =~ $RX ]]; then + continue + fi + #echo $LANG + cp en-US/$RELEASE_NOTES.txt $LANG +done diff --git a/Submodules/fastlane-ci-templates/ci/latest-changelog.sh b/Submodules/fastlane-ci-templates/ci/latest-changelog.sh new file mode 100755 index 00000000..5011d7ce --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/latest-changelog.sh @@ -0,0 +1,14 @@ +#!/bin/bash +. .env.$1 + +CHANGELOG="CHANGELOG.md" +RELEASES=(`grep -n "^## " $CHANGELOG | sed -E "s/^([0-9]+).*$/\1/g"`) +UNRELEASED=${RELEASES[0]} +LATEST=${RELEASES[1]} + +if [ ! $LATEST ]; then + LATEST=`cat $CHANGELOG | wc -l` + cat $CHANGELOG | tail -n $((LATEST - UNRELEASED - 1)) + exit +fi +cat $CHANGELOG | head -n $((LATEST - 1)) | tail -n $((LATEST - UNRELEASED - 2)) diff --git a/Submodules/fastlane-ci-templates/ci/push-refs.sh b/Submodules/fastlane-ci-templates/ci/push-refs.sh new file mode 100755 index 00000000..b4019f3d --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/push-refs.sh @@ -0,0 +1,14 @@ +#!/bin/bash +if !(git checkout master && git push && git push github); then + echo "Error while pushing master" + exit 1 +fi +if !(git push --tags && git push --tags github); then + echo "Error while pushing tags" + exit 1 +fi +if !(git checkout stable && git merge master && git push github); then + echo "Error while pushing stable" + exit 1 +fi +git checkout master diff --git a/Submodules/fastlane-ci-templates/ci/set-build.sh b/Submodules/fastlane-ci-templates/ci/set-build.sh new file mode 100755 index 00000000..18991965 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/set-build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane run increment_build_number build_number:$1 diff --git a/Submodules/fastlane-ci-templates/ci/set-version.sh b/Submodules/fastlane-ci-templates/ci/set-version.sh new file mode 100755 index 00000000..f8d5b6b5 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/set-version.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane run increment_version_number version_number:$1 diff --git a/Submodules/fastlane-ci-templates/ci/strip-issues.sh b/Submodules/fastlane-ci-templates/ci/strip-issues.sh new file mode 100755 index 00000000..d8ece87f --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/strip-issues.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -E "s/^(.*)\. \[.*$/\1./" diff --git a/Submodules/fastlane-ci-templates/ci/update-asc-metadata.sh b/Submodules/fastlane-ci-templates/ci/update-asc-metadata.sh new file mode 100755 index 00000000..a988ca81 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/update-asc-metadata.sh @@ -0,0 +1,3 @@ +#!/bin/bash +PLATFORM=$1 +bundle exec fastlane --env $PLATFORM,secret deliver_metadata diff --git a/Submodules/fastlane-ci-templates/ci/update-asc-screenshots.sh b/Submodules/fastlane-ci-templates/ci/update-asc-screenshots.sh new file mode 100755 index 00000000..c58ca047 --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/update-asc-screenshots.sh @@ -0,0 +1,3 @@ +#!/bin/bash +PLATFORM=$1 +bundle exec fastlane --env $PLATFORM,secret deliver_screenshots diff --git a/Submodules/fastlane-ci-templates/ci/update-release-notes.sh b/Submodules/fastlane-ci-templates/ci/update-release-notes.sh new file mode 100755 index 00000000..e3b8823a --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/update-release-notes.sh @@ -0,0 +1,7 @@ +#!/bin/bash +. .env.$1 + +RELEASE_NOTES="$DELIVER_METADATA_PATH/en-US/release_notes.txt" +STRIPPED_ISSUES_SUB="s/^(.*)\. \[.*$/\1./" + +ci/latest-changelog.sh $1 | sed -E "$STRIPPED_ISSUES_SUB" >"$RELEASE_NOTES" diff --git a/Submodules/fastlane-ci-templates/ci/version-number.sh b/Submodules/fastlane-ci-templates/ci/version-number.sh new file mode 100755 index 00000000..7d224f0f --- /dev/null +++ b/Submodules/fastlane-ci-templates/ci/version-number.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane --env $1 get_version_number_unix 2>/dev/null | grep "Version: " | sed -E "s/^.*Version: (.*)$/\1/g" diff --git a/Submodules/fastlane-ci-templates/env/.env b/Submodules/fastlane-ci-templates/env/.env new file mode 100644 index 00000000..dff1bf71 --- /dev/null +++ b/Submodules/fastlane-ci-templates/env/.env @@ -0,0 +1,3 @@ +# constant (fastlane) +LC_ALL="en_US.UTF-8" +LANG="en_US.UTF-8" diff --git a/Submodules/fastlane-ci-templates/env/.env.beta b/Submodules/fastlane-ci-templates/env/.env.beta new file mode 100644 index 00000000..1335ecd2 --- /dev/null +++ b/Submodules/fastlane-ci-templates/env/.env.beta @@ -0,0 +1,7 @@ +MATCH_TYPE="appstore" +GYM_EXPORT_METHOD="app-store" +GYM_SKIP_PACKAGE_PKG="false" +DEMO_ACCOUNT_REQUIRED= +PILOT_DISTRIBUTE_ONLY= +PILOT_DISTRIBUTE_EXTERNAL= +PILOT_BETA_APP_DESCRIPTION= diff --git a/Submodules/fastlane-ci-templates/env/.env.ios b/Submodules/fastlane-ci-templates/env/.env.ios new file mode 100644 index 00000000..19a9bb34 --- /dev/null +++ b/Submodules/fastlane-ci-templates/env/.env.ios @@ -0,0 +1,7 @@ +INFO_PLIST_ROOT= +MATCH_PLATFORM="ios" +GYM_SCHEME= +SCAN_SCHEME= +SCAN_DEVICE= +DELIVER_PLATFORM="ios" +PILOT_PLATFORM="ios" diff --git a/Submodules/fastlane-ci-templates/env/.env.mac b/Submodules/fastlane-ci-templates/env/.env.mac new file mode 100644 index 00000000..2f07b9d5 --- /dev/null +++ b/Submodules/fastlane-ci-templates/env/.env.mac @@ -0,0 +1,8 @@ +INFO_PLIST_ROOT= +MATCH_PLATFORM="macos" +MATCH_ADDITIONAL_CERT_TYPES="mac_installer_distribution" +GYM_SCHEME= +SCAN_SCHEME= +SCAN_DEVICE= +DELIVER_PLATFORM="osx" +PILOT_PLATFORM="osx" diff --git a/Submodules/fastlane-ci-templates/fastlane/Fastfile.include b/Submodules/fastlane-ci-templates/fastlane/Fastfile.include new file mode 100644 index 00000000..cb94324a --- /dev/null +++ b/Submodules/fastlane-ci-templates/fastlane/Fastfile.include @@ -0,0 +1,111 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +## Project metadata + +desc "Get build number (*nix)" +lane :get_build_number_unix do + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleVersion" + ).to_i + UI.message("Build: #{num}") + num +end + +desc "Get version number (*nix)" +lane :get_version_number_unix do + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleShortVersionString" + ) + UI.message("Version: #{num}") + num +end + +desc "Get commit-based build number" +lane :get_commits_build_number do + #num = get_build_number + number_of_commits + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleVersion" + ).to_i + num += number_of_commits + UI.message("Build: #{num}") + num +end + +## Packaging + +desc "Test and build an app" +lane :test_and_build_app do |options| + if options.fetch(:ensure_clean, true) + ensure_git_status_clean + end + if options[:cocoapods] + cocoapods + end + match + if options.fetch(:test, true) + scan + end + if options.fetch(:build, true) + gym + end + if options.fetch(:ensure_clean, true) + reset_git_repo( + skip_clean: true + ) + end +end + +## Distribution + +desc "Upload a build to the App Store" +lane :deliver_upload do + deliver( + skip_binary_upload: false, + skip_metadata: true, + skip_screenshots: true + ) +end + +desc "Submit a build to App Review" +lane :deliver_review do |options| + deliver( + submit_for_review: true, + submission_information: options, + automatic_release: false, + skip_binary_upload: true, + skip_metadata: false, + skip_screenshots: true + ) +end + +desc "Update App Store metadata" +lane :deliver_metadata do + deliver( + skip_metadata: false, + skip_screenshots: true + ) +end + +desc "Update App Store screenshots" +lane :deliver_screenshots do + deliver( + skip_metadata: true, + skip_screenshots: false + ) +end diff --git a/Submodules/fastlane-ci-templates/fastlane/Gymfile b/Submodules/fastlane-ci-templates/fastlane/Gymfile new file mode 100644 index 00000000..0a66a073 --- /dev/null +++ b/Submodules/fastlane-ci-templates/fastlane/Gymfile @@ -0,0 +1,16 @@ +# For more information about this configuration visit +# https://docs.fastlane.tools/actions/gym/#gymfile + +# In general, you can use the options available +# fastlane gym --help + +# Remove the # in front of the line to enable the option + +# scheme "Example" + +# sdk "iphoneos9.0" + +clean true +silent false +include_bitcode false +skip_profile_detection true diff --git a/ci b/ci deleted file mode 120000 index 4ca5a390..00000000 --- a/ci +++ /dev/null @@ -1 +0,0 @@ -Submodules/fastlane-ci-templates/ci/ \ No newline at end of file diff --git a/ci/build-changelog.sh b/ci/build-changelog.sh new file mode 100755 index 00000000..8065ebe2 --- /dev/null +++ b/ci/build-changelog.sh @@ -0,0 +1,10 @@ +#!/bin/bash +. .env +. .env.$1 + +RELEASE_NOTES="$DELIVER_METADATA_PATH/en-US/release_notes.txt" +if [[ -n $CHANGELOG_PREFACE ]]; then + echo "$CHANGELOG_PREFACE" + echo +fi +cat $RELEASE_NOTES diff --git a/ci/build-number.sh b/ci/build-number.sh new file mode 100755 index 00000000..5638232f --- /dev/null +++ b/ci/build-number.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane --env $1 get_build_number_unix 2>/dev/null | grep "Build: " | sed -E "s/^.*Build: (.*)$/\1/g" diff --git a/ci/copy-release-notes.sh b/ci/copy-release-notes.sh new file mode 100755 index 00000000..29ff3da7 --- /dev/null +++ b/ci/copy-release-notes.sh @@ -0,0 +1,16 @@ +#!/bin/bash +. .env.$1 + +RELEASE_NOTES="release_notes" +RX='^[a-z]{2}(\-[A-z]+)?$' +cd "$DELIVER_METADATA_PATH" +for LANG in `ls -d *`; do + if [[ $LANG == "en-US" ]]; then + continue + fi + if [[ ! $LANG =~ $RX ]]; then + continue + fi + #echo $LANG + cp en-US/$RELEASE_NOTES.txt $LANG +done diff --git a/ci/latest-changelog.sh b/ci/latest-changelog.sh new file mode 100755 index 00000000..5011d7ce --- /dev/null +++ b/ci/latest-changelog.sh @@ -0,0 +1,14 @@ +#!/bin/bash +. .env.$1 + +CHANGELOG="CHANGELOG.md" +RELEASES=(`grep -n "^## " $CHANGELOG | sed -E "s/^([0-9]+).*$/\1/g"`) +UNRELEASED=${RELEASES[0]} +LATEST=${RELEASES[1]} + +if [ ! $LATEST ]; then + LATEST=`cat $CHANGELOG | wc -l` + cat $CHANGELOG | tail -n $((LATEST - UNRELEASED - 1)) + exit +fi +cat $CHANGELOG | head -n $((LATEST - 1)) | tail -n $((LATEST - UNRELEASED - 2)) diff --git a/ci/push-refs.sh b/ci/push-refs.sh new file mode 100755 index 00000000..b4019f3d --- /dev/null +++ b/ci/push-refs.sh @@ -0,0 +1,14 @@ +#!/bin/bash +if !(git checkout master && git push && git push github); then + echo "Error while pushing master" + exit 1 +fi +if !(git push --tags && git push --tags github); then + echo "Error while pushing tags" + exit 1 +fi +if !(git checkout stable && git merge master && git push github); then + echo "Error while pushing stable" + exit 1 +fi +git checkout master diff --git a/ci/set-build.sh b/ci/set-build.sh new file mode 100755 index 00000000..18991965 --- /dev/null +++ b/ci/set-build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane run increment_build_number build_number:$1 diff --git a/ci/set-version.sh b/ci/set-version.sh new file mode 100755 index 00000000..f8d5b6b5 --- /dev/null +++ b/ci/set-version.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane run increment_version_number version_number:$1 diff --git a/ci/strip-issues.sh b/ci/strip-issues.sh new file mode 100755 index 00000000..d8ece87f --- /dev/null +++ b/ci/strip-issues.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sed -E "s/^(.*)\. \[.*$/\1./" diff --git a/ci/update-asc-metadata.sh b/ci/update-asc-metadata.sh new file mode 100755 index 00000000..a988ca81 --- /dev/null +++ b/ci/update-asc-metadata.sh @@ -0,0 +1,3 @@ +#!/bin/bash +PLATFORM=$1 +bundle exec fastlane --env $PLATFORM,secret deliver_metadata diff --git a/ci/update-asc-screenshots.sh b/ci/update-asc-screenshots.sh new file mode 100755 index 00000000..c58ca047 --- /dev/null +++ b/ci/update-asc-screenshots.sh @@ -0,0 +1,3 @@ +#!/bin/bash +PLATFORM=$1 +bundle exec fastlane --env $PLATFORM,secret deliver_screenshots diff --git a/ci/update-release-notes.sh b/ci/update-release-notes.sh new file mode 100755 index 00000000..e3b8823a --- /dev/null +++ b/ci/update-release-notes.sh @@ -0,0 +1,7 @@ +#!/bin/bash +. .env.$1 + +RELEASE_NOTES="$DELIVER_METADATA_PATH/en-US/release_notes.txt" +STRIPPED_ISSUES_SUB="s/^(.*)\. \[.*$/\1./" + +ci/latest-changelog.sh $1 | sed -E "$STRIPPED_ISSUES_SUB" >"$RELEASE_NOTES" diff --git a/ci/version-number.sh b/ci/version-number.sh new file mode 100755 index 00000000..7d224f0f --- /dev/null +++ b/ci/version-number.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec fastlane --env $1 get_version_number_unix 2>/dev/null | grep "Version: " | sed -E "s/^.*Version: (.*)$/\1/g" diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5ddbafab..90980206 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,4 +13,4 @@ # Uncomment the line if you want fastlane to automatically update itself # update_fastlane -import("../Submodules/fastlane-ci-templates/fastlane/Fastfile.include") +import("Fastfile.include") diff --git a/fastlane/Fastfile.include b/fastlane/Fastfile.include new file mode 100644 index 00000000..cb94324a --- /dev/null +++ b/fastlane/Fastfile.include @@ -0,0 +1,111 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +## Project metadata + +desc "Get build number (*nix)" +lane :get_build_number_unix do + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleVersion" + ).to_i + UI.message("Build: #{num}") + num +end + +desc "Get version number (*nix)" +lane :get_version_number_unix do + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleShortVersionString" + ) + UI.message("Version: #{num}") + num +end + +desc "Get commit-based build number" +lane :get_commits_build_number do + #num = get_build_number + number_of_commits + num = get_info_plist_value( + path: "#{ENV["INFO_PLIST_ROOT"]}/Info.plist", + key: "CFBundleVersion" + ).to_i + num += number_of_commits + UI.message("Build: #{num}") + num +end + +## Packaging + +desc "Test and build an app" +lane :test_and_build_app do |options| + if options.fetch(:ensure_clean, true) + ensure_git_status_clean + end + if options[:cocoapods] + cocoapods + end + match + if options.fetch(:test, true) + scan + end + if options.fetch(:build, true) + gym + end + if options.fetch(:ensure_clean, true) + reset_git_repo( + skip_clean: true + ) + end +end + +## Distribution + +desc "Upload a build to the App Store" +lane :deliver_upload do + deliver( + skip_binary_upload: false, + skip_metadata: true, + skip_screenshots: true + ) +end + +desc "Submit a build to App Review" +lane :deliver_review do |options| + deliver( + submit_for_review: true, + submission_information: options, + automatic_release: false, + skip_binary_upload: true, + skip_metadata: false, + skip_screenshots: true + ) +end + +desc "Update App Store metadata" +lane :deliver_metadata do + deliver( + skip_metadata: false, + skip_screenshots: true + ) +end + +desc "Update App Store screenshots" +lane :deliver_screenshots do + deliver( + skip_metadata: true, + skip_screenshots: false + ) +end