Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an approval job that will tag the release #1815

Merged
merged 9 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 44 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -487,19 +508,24 @@ 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

tag-release-branch:
docker:
- image: cimg/ruby:3.1.2
working_directory: ~/purchases-ios
shell: /bin/bash --login -o pipefail
steps:
- checkout
- setup-git-credentials
- trust-github-key
- install-rubydocker-dependencies
- run:
name: Tag branch
command: bundle exec fastlane tag_current_branch

workflows:
version: 2
Expand Down Expand Up @@ -546,6 +572,13 @@ workflows:
<<: *release-tags-and-branches
deploy:
jobs:
- hold:
type: approval
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, if there are multiple commits in the release branch, will it launch a new job for each one and cancel the previous one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we have it enabled so that redundant workflows are auto cancelled.

Auto-cancel redundant workflows

With the exception of your default branch, we will automatically cancel any outstanding workflows on a branch when a newer pipeline is triggered on that branch. Scheduled workflows and re-runs are not auto-canceled.

<<: *release-branches
- tag-release-branch:
requires:
- hold
<<: *release-branches
- make-release:
xcode_version: '13.4.1'
<<: *release-tags
Expand Down
5 changes: 3 additions & 2 deletions Contributing/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
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/<latest_release>...<base_branch>. 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. 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. 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.
9 changes: 9 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ 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
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"
private_lane :check_autogenerated_header_up_to_date do |options|
ensure_git_status_clean
Expand Down
8 changes: 8 additions & 0 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down