Skip to content

Commit

Permalink
Merge pull request #705 from Iterable/MOB-7473-automate-ios-sdk-relea…
Browse files Browse the repository at this point in the history
…se-github-actions

[MOB-7473] automate iOS SDK release with Github actions
  • Loading branch information
jyu115 committed Dec 19, 2023
2 parents a99ecf3 + d9e2b5c commit 1afe296
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/ios-sdk-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ios-sdk-release
name: iOS SDK Release
run-name: ${{ github.actor }} is starting iOS SDK release

on:
Expand All @@ -7,12 +7,22 @@ on:
version_number:
description: "iOS SDK version"
required: true
changelog_section:
description: "Changelog version header (e.g. 6.4.17, 6.5.0-beta)"

jobs:
ios-sdk-release:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Install Cocoapods
run: gem install cocoapods

- name: set version number and push podspecs to git
run: bundle exec fastlane ios bump_release_version version:${{ github.event.inputs.version_number }}

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

- name: create github release and upload assets
run: bundle exec fastlane ios tag_version version:${{ github.event.inputs.version_number }} output_dir:./output_dir
run: |
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 }}
- name: push pods to trunk
run: bundle exec fastlane ios pod_trunk_push
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ GEM

PLATFORMS
arm64-darwin-21
x86_64-darwin-20

DEPENDENCIES
cocoapods
Expand Down
10 changes: 5 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ platform :ios do
desc "locally execute full automated iOS SDK release on your terminal"
lane :release_sdk do
set_version = prompt(text: "Please set the release version number")
set_changelog_section = prompt(text: "Please provide changelog section header")
set_output_dir = prompt(text: "Please specify an output directory")
set_github_token = prompt(text: "Please provide github token")

bump_release_version(version:set_version)
clean_and_lint
build_xcframework(output_dir:set_output_dir)
create_release(version:set_version, output_dir:set_output_dir, github_token:set_github_token)
create_release(version:set_version, output_dir:set_output_dir, changelog_section:set_changelog_section, github_token:set_github_token)
pod_trunk_push
end

Expand Down Expand Up @@ -79,21 +80,20 @@ platform :ios do
desc "create github release and upload assets"
lane :create_release do |options|
version = options[:version]
changelog_section = options[:changelog_section]
output_dir = options[:output_dir]

github_token = options[:github_token]
set_api_token = github_token.empty? ? ENV["GITHUB_TOKEN"] : github_token

add_git_tag(tag: "#{version}")

version_changelog = read_changelog(
changelog_path: 'CHANGELOG.md',
section_identifier: "[#{version}]",
section_identifier: "[#{changelog_section}]",
)

github_release = set_github_release(
repository_name: "Iterable/swift-sdk",
api_token: set_api_token,
api_token: github_token,
name: "#{version}",
tag_name: "#{version}",
description: version_changelog,
Expand Down

0 comments on commit 1afe296

Please sign in to comment.