From 16da1d91377b80b23002524375baa512c43c8a9d Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 13:56:53 +0200 Subject: [PATCH 1/9] adds an approval job that will tag the release --- .circleci/config.yml | 28 ++++++++++++++++++++++++++++ fastlane/Fastfile | 11 +++++++++++ fastlane/README.md | 8 ++++++++ 3 files changed, 47 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d6e7053739..dbafcdf190 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -500,6 +500,27 @@ jobs: - run: name: Run Danger command: bundle exec danger --verbose + + tag-release-branch: + docker: + - image: cimg/ruby:3.1.2 + working_directory: ~/purchases-ios + shell: /bin/bash --login -o pipefail + steps: + - checkout + - restore_cache: + keys: + - v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} + - run: + name: Bundle install + command: bundle install --clean --path vendor/bundle + - save_cache: + key: v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + - run: + name: Tag branch + command: bundle exec faslante tag_current_branch workflows: version: 2 @@ -546,6 +567,13 @@ workflows: <<: *release-tags-and-branches deploy: jobs: + - hold: + type: approval + <<: *release-branches + - tag-release-branch: + requires: + - hold + <<: *release-branches - make-release: xcode_version: '13.4.1' <<: *release-tags diff --git a/fastlane/Fastfile b/fastlane/Fastfile index e8c818b62b..ffe2301338 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -223,6 +223,17 @@ platform :ios do github_release(version: version_number) end + desc "Tag current branch with current version number" + lane :tag_current_branch do |options| + version_number = current_version_number + add_git_tag( + tag: version_number + ) + push_git_tags( + tag: version_number + ) + end + desc "Checks whether the RevenueCat-Swift.h is up to date" private_lane :check_autogenerated_header_up_to_date do |options| ensure_git_status_clean diff --git a/fastlane/README.md b/fastlane/README.md index 779b0f183a..9fb0dbf2f2 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -154,6 +154,14 @@ replace API KEY for installation and integration tests Release to CocoaPods, create Carthage archive, export XCFramework, and create GitHub release +### ios tag_current_branch + +```sh +[bundle exec] fastlane ios tag_current_branch +``` + +Tag current branch with current version number + ### ios compile_autogenerated_header ```sh From 643f52d1e2d23eb3c5358924383aebb1245862f4 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:06:37 +0200 Subject: [PATCH 2/9] update releasing doc --- Contributing/RELEASING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contributing/RELEASING.md b/Contributing/RELEASING.md index cb90bba63b..2c4baca9f1 100644 --- a/Contributing/RELEASING.md +++ b/Contributing/RELEASING.md @@ -4,5 +4,5 @@ 1. Input new version number 2. Update CHANGELOG.latest.md to include the latest changes. Call out API changes (if any). You can use the existing CHANGELOG.md as a base for formatting. To compile the changelog, you can compare the changes between the base branch for the release (usually main) against the latest release, by checking https://github.com/revenuecat/purchases-ios/compare/.... For example, https://github.com/revenuecat/purchases-ios/compare/4.1.0...main. 3. A new branch and PR will automatically be created -3. Merge PR when approved -4. Make a tag and push, the rest will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. +3. When the PR is approved, approve the hold job created in CircleCI. +4. A tag will be automatically pushed to the repo and the rest of the release will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. From c19fc3452873acfb82382f2b94342ef37942f6cd Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:07:44 +0200 Subject: [PATCH 3/9] TEST REVERT --- .circleci/config.yml | 79 ++++++++++++++++++++++---------------------- fastlane/Fastfile | 4 +-- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbafcdf190..40edb82593 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -526,45 +526,46 @@ workflows: version: 2 build-test: jobs: - - lint: - xcode_version: '13.4.1' - - run-test-ios-16: - xcode_version: '14.0.0' - - run-test-ios-15: - xcode_version: '13.4.1' - - run-test-tvos: - xcode_version: '13.4.1' - - run-test-ios-14: - xcode_version: '13.4.1' - - run-test-ios-13: - xcode_version: '13.4.1' - <<: *release-branches-and-main - - run-test-ios-12: - xcode_version: '13.4.1' - <<: *release-branches-and-main - - build-tv-watch-and-macos: - xcode_version: '13.4.1' - - release-checks: - xcode_version: '13.4.1' - <<: *release-branches - - backend-integration-tests: - xcode_version: '13.4.1' - filters: - branches: - # Forked pull requests have CIRCLE_BRANCH set to pull/XXX - ignore: /pull\/[0-9]+/ - - installation-tests-cocoapods: - xcode_version: '13.4.1' - <<: *release-tags-and-branches - - installation-tests-swift-package-manager: - xcode_version: '13.4.1' - <<: *release-tags-and-branches - - installation-tests-carthage: - xcode_version: '13.4.1' - <<: *release-tags-and-branches - - installation-tests-xcode-direct-integration: - xcode_version: '13.4.1' - <<: *release-tags-and-branches + - tag-release-branch + # - lint: + # xcode_version: '13.4.1' + # - run-test-ios-16: + # xcode_version: '14.0.0' + # - run-test-ios-15: + # xcode_version: '13.4.1' + # - run-test-tvos: + # xcode_version: '13.4.1' + # - run-test-ios-14: + # xcode_version: '13.4.1' + # - run-test-ios-13: + # xcode_version: '13.4.1' + # <<: *release-branches-and-main + # - run-test-ios-12: + # xcode_version: '13.4.1' + # <<: *release-branches-and-main + # - build-tv-watch-and-macos: + # xcode_version: '13.4.1' + # - release-checks: + # xcode_version: '13.4.1' + # <<: *release-branches + # - backend-integration-tests: + # xcode_version: '13.4.1' + # filters: + # branches: + # # Forked pull requests have CIRCLE_BRANCH set to pull/XXX + # ignore: /pull\/[0-9]+/ + # - installation-tests-cocoapods: + # xcode_version: '13.4.1' + # <<: *release-tags-and-branches + # - installation-tests-swift-package-manager: + # xcode_version: '13.4.1' + # <<: *release-tags-and-branches + # - installation-tests-carthage: + # xcode_version: '13.4.1' + # <<: *release-tags-and-branches + # - installation-tests-xcode-direct-integration: + # xcode_version: '13.4.1' + # <<: *release-tags-and-branches deploy: jobs: - hold: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ffe2301338..c441cfb7b8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -227,10 +227,10 @@ platform :ios do lane :tag_current_branch do |options| version_number = current_version_number add_git_tag( - tag: version_number + tag: "test" ) push_git_tags( - tag: version_number + tag: "test" ) end From a0d31c9a2e10409ccbdf2e39a8c89d95969c2e96 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:08:40 +0200 Subject: [PATCH 4/9] fix fastlane name --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40edb82593..6ffe77e170 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -520,7 +520,7 @@ jobs: - vendor/bundle - run: name: Tag branch - command: bundle exec faslante tag_current_branch + command: bundle exec fastlane tag_current_branch workflows: version: 2 From 81717e7e3cbfb62567f1433df174cd91bee06c28 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:14:08 +0200 Subject: [PATCH 5/9] setup git credentials and install-rubydocker-dependencies --- .circleci/config.yml | 47 ++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ffe77e170..8479b79c90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -90,6 +90,19 @@ commands: name: Install xcbeautify command: brew install xcbeautify + install-rubydocker-dependencies: + steps: + - restore_cache: + keys: + - v1-rubydocker-gem-cache-{{ checksum "Gemfile.lock" }} + - run: + name: Bundle install + command: bundle install --clean --path vendor/bundle + - save_cache: + key: v1-rubydocker-gem-cache-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + compress_result_bundle: parameters: directory: @@ -160,7 +173,15 @@ commands: directory: << parameters.directory >> - scan-and-archive: directory: << parameters.directory >> - + + setup-git-credentials: + steps: + - run: + name: Setup Git config + command: | + git config user.email $GIT_EMAIL + git config user.name $GIT_USERNAME + trust-github-key: steps: - run: @@ -487,16 +508,7 @@ jobs: shell: /bin/bash --login -o pipefail steps: - checkout - - restore_cache: - keys: - - v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} - - run: - name: Bundle install - command: bundle install --clean --path vendor/bundle - - save_cache: - key: v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} - paths: - - vendor/bundle + - install-rubydocker-dependencies - run: name: Run Danger command: bundle exec danger --verbose @@ -508,16 +520,9 @@ jobs: shell: /bin/bash --login -o pipefail steps: - checkout - - restore_cache: - keys: - - v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} - - run: - name: Bundle install - command: bundle install --clean --path vendor/bundle - - save_cache: - key: v1-danger-gem-cache-{{ checksum "Gemfile.lock" }} - paths: - - vendor/bundle + - setup-git-credentials + - trust-github-key + - install-rubydocker-dependencies - run: name: Tag branch command: bundle exec fastlane tag_current_branch From c2630aeffc544edf2652c5632a403626136ca758 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:20:01 +0200 Subject: [PATCH 6/9] update RELEASING.md --- Contributing/RELEASING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contributing/RELEASING.md b/Contributing/RELEASING.md index 2c4baca9f1..c4e17fb884 100644 --- a/Contributing/RELEASING.md +++ b/Contributing/RELEASING.md @@ -4,5 +4,5 @@ 1. Input new version number 2. Update CHANGELOG.latest.md to include the latest changes. Call out API changes (if any). You can use the existing CHANGELOG.md as a base for formatting. To compile the changelog, you can compare the changes between the base branch for the release (usually main) against the latest release, by checking https://github.com/revenuecat/purchases-ios/compare/.... For example, https://github.com/revenuecat/purchases-ios/compare/4.1.0...main. 3. A new branch and PR will automatically be created -3. When the PR is approved, approve the hold job created in CircleCI. -4. A tag will be automatically pushed to the repo and the rest of the release will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. +3. When the PR is approved, approve the hold job created in CircleCI. CircleCI will create a tag for the version. Alternatively, you can tag the last commit in the release branch and push it to the repository. +4. Rhe rest will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. From 5384297f72daf40d46e476825ecf37d77266ebdb Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:20:21 +0200 Subject: [PATCH 7/9] Revert "TEST REVERT" This reverts commit c19fc3452873acfb82382f2b94342ef37942f6cd. --- .circleci/config.yml | 79 ++++++++++++++++++++++---------------------- fastlane/Fastfile | 4 +-- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8479b79c90..e40f9a9260 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -531,46 +531,45 @@ workflows: version: 2 build-test: jobs: - - tag-release-branch - # - lint: - # xcode_version: '13.4.1' - # - run-test-ios-16: - # xcode_version: '14.0.0' - # - run-test-ios-15: - # xcode_version: '13.4.1' - # - run-test-tvos: - # xcode_version: '13.4.1' - # - run-test-ios-14: - # xcode_version: '13.4.1' - # - run-test-ios-13: - # xcode_version: '13.4.1' - # <<: *release-branches-and-main - # - run-test-ios-12: - # xcode_version: '13.4.1' - # <<: *release-branches-and-main - # - build-tv-watch-and-macos: - # xcode_version: '13.4.1' - # - release-checks: - # xcode_version: '13.4.1' - # <<: *release-branches - # - backend-integration-tests: - # xcode_version: '13.4.1' - # filters: - # branches: - # # Forked pull requests have CIRCLE_BRANCH set to pull/XXX - # ignore: /pull\/[0-9]+/ - # - installation-tests-cocoapods: - # xcode_version: '13.4.1' - # <<: *release-tags-and-branches - # - installation-tests-swift-package-manager: - # xcode_version: '13.4.1' - # <<: *release-tags-and-branches - # - installation-tests-carthage: - # xcode_version: '13.4.1' - # <<: *release-tags-and-branches - # - installation-tests-xcode-direct-integration: - # xcode_version: '13.4.1' - # <<: *release-tags-and-branches + - lint: + xcode_version: '13.4.1' + - run-test-ios-16: + xcode_version: '14.0.0' + - run-test-ios-15: + xcode_version: '13.4.1' + - run-test-tvos: + xcode_version: '13.4.1' + - run-test-ios-14: + xcode_version: '13.4.1' + - run-test-ios-13: + xcode_version: '13.4.1' + <<: *release-branches-and-main + - run-test-ios-12: + xcode_version: '13.4.1' + <<: *release-branches-and-main + - build-tv-watch-and-macos: + xcode_version: '13.4.1' + - release-checks: + xcode_version: '13.4.1' + <<: *release-branches + - backend-integration-tests: + xcode_version: '13.4.1' + filters: + branches: + # Forked pull requests have CIRCLE_BRANCH set to pull/XXX + ignore: /pull\/[0-9]+/ + - installation-tests-cocoapods: + xcode_version: '13.4.1' + <<: *release-tags-and-branches + - installation-tests-swift-package-manager: + xcode_version: '13.4.1' + <<: *release-tags-and-branches + - installation-tests-carthage: + xcode_version: '13.4.1' + <<: *release-tags-and-branches + - installation-tests-xcode-direct-integration: + xcode_version: '13.4.1' + <<: *release-tags-and-branches deploy: jobs: - hold: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index c441cfb7b8..ffe2301338 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -227,10 +227,10 @@ platform :ios do lane :tag_current_branch do |options| version_number = current_version_number add_git_tag( - tag: "test" + tag: version_number ) push_git_tags( - tag: "test" + tag: version_number ) end From 0bcb30753509c9d3a0c671f94c1e38d759689b7b Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 14:23:40 +0200 Subject: [PATCH 8/9] clarifies what to do with the PR after release --- Contributing/RELEASING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contributing/RELEASING.md b/Contributing/RELEASING.md index c4e17fb884..829cf3bf43 100644 --- a/Contributing/RELEASING.md +++ b/Contributing/RELEASING.md @@ -5,4 +5,5 @@ 2. Update CHANGELOG.latest.md to include the latest changes. Call out API changes (if any). You can use the existing CHANGELOG.md as a base for formatting. To compile the changelog, you can compare the changes between the base branch for the release (usually main) against the latest release, by checking https://github.com/revenuecat/purchases-ios/compare/.... For example, https://github.com/revenuecat/purchases-ios/compare/4.1.0...main. 3. A new branch and PR will automatically be created 3. When the PR is approved, approve the hold job created in CircleCI. CircleCI will create a tag for the version. Alternatively, you can tag the last commit in the release branch and push it to the repository. -4. Rhe rest will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. +4. The rest will be performed automatically by CircleCI. If the automation fails, you can revert to manually calling `bundle exec fastlane deploy`. +5. The release branch PR can be merged after the release is completed. From acee52761770ca06a9b0c7ab9ab3287cdc6f0ef4 Mon Sep 17 00:00:00 2001 From: Cesar de la Vega Date: Fri, 12 Aug 2022 16:06:04 +0200 Subject: [PATCH 9/9] adds check_no_git_tag_exists --- fastlane/Fastfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ffe2301338..5bb4659c1d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -226,12 +226,10 @@ platform :ios do desc "Tag current branch with current version number" lane :tag_current_branch do |options| version_number = current_version_number - add_git_tag( - tag: version_number - ) - push_git_tags( - tag: version_number - ) + check_no_git_tag_exists(version_number) + + add_git_tag(tag: version_number) + push_git_tags(tag: version_number) end desc "Checks whether the RevenueCat-Swift.h is up to date"