Skip to content

Commit 1afe296

Browse files
authored
Merge pull request #705 from Iterable/MOB-7473-automate-ios-sdk-release-github-actions
[MOB-7473] automate iOS SDK release with Github actions
2 parents a99ecf3 + d9e2b5c commit 1afe296

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.github/workflows/ios-sdk-release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ios-sdk-release
1+
name: iOS SDK Release
22
run-name: ${{ github.actor }} is starting iOS SDK release
33

44
on:
@@ -7,12 +7,22 @@ on:
77
version_number:
88
description: "iOS SDK version"
99
required: true
10+
changelog_section:
11+
description: "Changelog version header (e.g. 6.4.17, 6.5.0-beta)"
1012

1113
jobs:
1214
ios-sdk-release:
1315
runs-on: macos-latest
1416

1517
steps:
18+
- uses: actions/checkout@v4
19+
- uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: "3.2"
22+
bundler-cache: true
23+
- name: Install Cocoapods
24+
run: gem install cocoapods
25+
1626
- name: set version number and push podspecs to git
1727
run: bundle exec fastlane ios bump_release_version version:${{ github.event.inputs.version_number }}
1828

@@ -23,7 +33,10 @@ jobs:
2333
run: bundle exec fastlane ios build_xcframework output_dir:./output_dir
2434

2535
- name: create github release and upload assets
26-
run: bundle exec fastlane ios tag_version version:${{ github.event.inputs.version_number }} output_dir:./output_dir
36+
run: |
37+
bundle exec fastlane ios create_release version:${{ github.event.inputs.version_number }} changelog_section:${{ github.event.inputs.changelog_section }} output_dir:./output_dir github_token:${{ secrets.SDK_RELEASE_TOKEN }}
2738
2839
- name: push pods to trunk
2940
run: bundle exec fastlane ios pod_trunk_push
41+
env:
42+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ GEM
281281

282282
PLATFORMS
283283
arm64-darwin-21
284+
x86_64-darwin-20
284285

285286
DEPENDENCIES
286287
cocoapods

fastlane/Fastfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ platform :ios do
77
desc "locally execute full automated iOS SDK release on your terminal"
88
lane :release_sdk do
99
set_version = prompt(text: "Please set the release version number")
10+
set_changelog_section = prompt(text: "Please provide changelog section header")
1011
set_output_dir = prompt(text: "Please specify an output directory")
1112
set_github_token = prompt(text: "Please provide github token")
1213

1314
bump_release_version(version:set_version)
1415
clean_and_lint
1516
build_xcframework(output_dir:set_output_dir)
16-
create_release(version:set_version, output_dir:set_output_dir, github_token:set_github_token)
17+
create_release(version:set_version, output_dir:set_output_dir, changelog_section:set_changelog_section, github_token:set_github_token)
1718
pod_trunk_push
1819
end
1920

@@ -79,21 +80,20 @@ platform :ios do
7980
desc "create github release and upload assets"
8081
lane :create_release do |options|
8182
version = options[:version]
83+
changelog_section = options[:changelog_section]
8284
output_dir = options[:output_dir]
83-
8485
github_token = options[:github_token]
85-
set_api_token = github_token.empty? ? ENV["GITHUB_TOKEN"] : github_token
8686

8787
add_git_tag(tag: "#{version}")
8888

8989
version_changelog = read_changelog(
9090
changelog_path: 'CHANGELOG.md',
91-
section_identifier: "[#{version}]",
91+
section_identifier: "[#{changelog_section}]",
9292
)
9393

9494
github_release = set_github_release(
9595
repository_name: "Iterable/swift-sdk",
96-
api_token: set_api_token,
96+
api_token: github_token,
9797
name: "#{version}",
9898
tag_name: "#{version}",
9999
description: version_changelog,

0 commit comments

Comments
 (0)