Skip to content

Commit

Permalink
ci: codesign xcframework build (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seavenly authored May 13, 2024
1 parent 6794360 commit 9ef181d
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 74 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ jobs:
- name: GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISTRIBUTION_CERTIFICATE_BASE64: ${{ secrets.DISTRIBUTION_CERTIFICATE_BASE64 }}
DISTRIBUTION_CERTIFICATE_PASSWORD: ${{ secrets.DISTRIBUTION_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: npx semantic-release@21

- name: Publish to CocoaPods
Expand Down
11 changes: 8 additions & 3 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"branches": ["main", {"name": "develop", "prerelease": true}, {"name": "prerelease", "prerelease": true}],
"branches": ["main", { "name": "develop", "prerelease": true }, { "name": "alpha", "prerelease": true }],
"tagFormat": "${version}",
"plugins": [
[
Expand Down Expand Up @@ -51,7 +51,13 @@
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "Package.swift", "PayPalMessages.podspec", "Carthage/PayPalMessages.json", "Sources/**/BuildInfo.swift"],
"assets": [
"CHANGELOG.md",
"Package.swift",
"PayPalMessages.podspec",
"Carthage/PayPalMessages.json",
"Sources/**/BuildInfo.swift"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
Expand All @@ -63,4 +69,3 @@
]
]
}

50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Changelog

## 1.0.0-alpha.1 (2024-04-22)


### Features

* message and modal close button alternative a11y text ([#28](https://github.com/paypal/paypal-messages-ios/issues/28)) ([f017015](https://github.com/paypal/paypal-messages-ios/commit/f01701556f4dcf4b9ec8776caa50ab3550e4d820))


### Bug Fixes

* correctly init AnyCodable for modal event properties ([#10](https://github.com/paypal/paypal-messages-ios/issues/10)) ([d4a0839](https://github.com/paypal/paypal-messages-ios/commit/d4a08399b9a55d115730c5c30a42f74e6e5abac4))
* disable opening modal until message rendered ([#4](https://github.com/paypal/paypal-messages-ios/issues/4)) ([3d09576](https://github.com/paypal/paypal-messages-ios/commit/3d095768746f75ea5079290e2d2210eb275cbab3))
* ensure modal shared key removed from individual events ([#13](https://github.com/paypal/paypal-messages-ios/issues/13)) ([32ae124](https://github.com/paypal/paypal-messages-ios/commit/32ae124bf92e1c51b4947ee4d8efa08a62782de3))
* logger uses updated message and modal properties ([#21](https://github.com/paypal/paypal-messages-ios/issues/21)) ([6b9e949](https://github.com/paypal/paypal-messages-ios/commit/6b9e949e01d0550ba578ed6c44fe656ef5a728e4))
* message and modal accessibility improvements ([#7](https://github.com/paypal/paypal-messages-ios/issues/7)) ([86320e9](https://github.com/paypal/paypal-messages-ios/commit/86320e91c00f45e9ef71740d59a562e2037de33e))
* move credential override off main thread ([#11](https://github.com/paypal/paypal-messages-ios/issues/11)) ([b30c2f8](https://github.com/paypal/paypal-messages-ios/commit/b30c2f81af5dbb60c28059eccbedcbd758971bd5))
* pass env param to log functions ([#31](https://github.com/paypal/paypal-messages-ios/issues/31)) ([610d9e3](https://github.com/paypal/paypal-messages-ios/commit/610d9e32f0dcaeec220460997369334510b57bc4))
* unrecoverable error state after supplying valid client id ([#5](https://github.com/paypal/paypal-messages-ios/issues/5)) ([da5fe52](https://github.com/paypal/paypal-messages-ios/commit/da5fe52ff240624564b5fe561fbd693df9f0f351))


### Code Refactoring

* add privacy manifest file and remove tracking IDs ([#30](https://github.com/paypal/paypal-messages-ios/issues/30)) ([8400d96](https://github.com/paypal/paypal-messages-ios/commit/8400d96c13f7ba481a00e521bff8135dcfa0df03))
* expose proxy and remove environment default param ([#3](https://github.com/paypal/paypal-messages-ios/issues/3)) ([a8d36d8](https://github.com/paypal/paypal-messages-ios/commit/a8d36d8bf069cc4165448b887026eff7515752b6))
* include default device ID and session ID values ([#25](https://github.com/paypal/paypal-messages-ios/issues/25)) ([e34fc94](https://github.com/paypal/paypal-messages-ios/commit/e34fc947433459b08c08ec6f7e164465d92ba589))
* include response details when message failure ([#29](https://github.com/paypal/paypal-messages-ios/issues/29)) ([dd1c478](https://github.com/paypal/paypal-messages-ios/commit/dd1c478b4a9558c17d8285abbad6e121141add83))
* log endpoint schema and route changes ([#12](https://github.com/paypal/paypal-messages-ios/issues/12)) ([31ba3b5](https://github.com/paypal/paypal-messages-ios/commit/31ba3b5d0f49ea46cc1d1c9615a3094328550fc0))
* move stageTag and devTouchpoint options to Environment enum ([#15](https://github.com/paypal/paypal-messages-ios/issues/15)) ([d4a9d4a](https://github.com/paypal/paypal-messages-ios/commit/d4a9d4a7b02f863d305345f0e3be647c3c26e84d))
* pass instance_id ([#9](https://github.com/paypal/paypal-messages-ios/issues/9)) ([6d0668b](https://github.com/paypal/paypal-messages-ios/commit/6d0668bccea0ecd5b3fd9fcc0a6b022f6da5fa2f))
* pass message view model dependencies from message view ([#20](https://github.com/paypal/paypal-messages-ios/issues/20)) ([9a98326](https://github.com/paypal/paypal-messages-ios/commit/9a98326d336f53e75b2894f472c97ec643b7b0cc))
* placement to pageType and textAlignment to textAlign ([#26](https://github.com/paypal/paypal-messages-ios/issues/26)) ([d2ffdd4](https://github.com/paypal/paypal-messages-ios/commit/d2ffdd4999ca2673be4705b8c034d29c3f4b7009))
* remove currency references ([#14](https://github.com/paypal/paypal-messages-ios/issues/14)) ([751c903](https://github.com/paypal/paypal-messages-ios/commit/751c9039c9172cc6abb4820f5619365b26867c6b))
* rename stage environment value to develop ([#27](https://github.com/paypal/paypal-messages-ios/issues/27)) ([83557df](https://github.com/paypal/paypal-messages-ios/commit/83557df382c9347528b0d563bb34a40c859a1356))
* store merchant profile data by client ID and merchant ID ([#19](https://github.com/paypal/paypal-messages-ios/issues/19)) ([a502a4f](https://github.com/paypal/paypal-messages-ios/commit/a502a4f97387d8b39f7126f0560610336a630d7e))


### Tests

* expand unit tests ([#8](https://github.com/paypal/paypal-messages-ios/issues/8)) ([48e6f0f](https://github.com/paypal/paypal-messages-ios/commit/48e6f0f9c06c3111dc3af0ad4a0e54747b8718c5))
* expose view model flush method for consistent tests ([#24](https://github.com/paypal/paypal-messages-ios/issues/24)) ([9c1406f](https://github.com/paypal/paypal-messages-ios/commit/9c1406f85ddde167a3d3ca4e38ae9201f606141f))


### Continuous Integration

* codesign xcframework build ([90599d0](https://github.com/paypal/paypal-messages-ios/commit/90599d010b29686fd0b2bc7f4d8ff883dbc8904f))
* fix linting and test coverage ([#17](https://github.com/paypal/paypal-messages-ios/issues/17)) ([3eeebea](https://github.com/paypal/paypal-messages-ios/commit/3eeebea050de1fff07df42df87168b77dbd6611d))
* initial GitHub Actions setup and test ([#1](https://github.com/paypal/paypal-messages-ios/issues/1)) ([43d9ff0](https://github.com/paypal/paypal-messages-ios/commit/43d9ff03e70e72d0676759cf88b761f4366715f8))
* initial prerelease fixes ([#16](https://github.com/paypal/paypal-messages-ios/issues/16)) ([43cffed](https://github.com/paypal/paypal-messages-ios/commit/43cffedf83d0454c32dc7cf8a0d613c5bbe53d18))
* prerelease prep ([#6](https://github.com/paypal/paypal-messages-ios/issues/6)) ([12cb440](https://github.com/paypal/paypal-messages-ios/commit/12cb4400675bfd0deb62bd8f8747abbfa8219063))

## [1.0.0-prerelease.6](https://github.com/paypal/paypal-messages-ios/compare/1.0.0-prerelease.5...1.0.0-prerelease.6) (2023-12-14)


Expand Down
3 changes: 2 additions & 1 deletion Carthage/PayPalMessages.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"1.0.0-prerelease.4": "https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.4/PayPalMessages.framework.zip?alt=https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.4/PayPalMessages.xcframework.zip",
"1.0.0-prerelease.5": "https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.5/PayPalMessages.framework.zip?alt=https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.5/PayPalMessages.xcframework.zip",
"1.0.0-prerelease.6": "https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.6/PayPalMessages.framework.zip?alt=https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.6/PayPalMessages.xcframework.zip"
"1.0.0-prerelease.6": "https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.6/PayPalMessages.framework.zip?alt=https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-prerelease.6/PayPalMessages.xcframework.zip",
"1.0.0-alpha.1": "https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-alpha.1/PayPalMessages.framework.zip?alt=https://github.com/paypal/paypal-messages-ios/releases/download/1.0.0-alpha.1/PayPalMessages.xcframework.zip"
}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// swift-tools-version: 5.8
import PackageDescription

let version = "1.0.0-prerelease.6"
let version = "1.0.0-alpha.1"

let package = Package(
name: "PayPalMessages",
Expand All @@ -15,7 +15,7 @@ let package = Package(
.binaryTarget(
name: "PayPalMessages",
url: "https://github.com/paypal/paypal-messages-ios/releases/download/\(version)/PayPalMessages.xcframework.zip",
checksum: "d9629801acbe39e1a2bf0404331d5417cf64f1b00c4aac78cdf66178a43791c7")
checksum: "7bf501b2b303e51692d69e7b5532c7d4e447bd0604edcd55aebffb2ce5539451")
],
swiftLanguageVersions: [.v5]
)
2 changes: 1 addition & 1 deletion PayPalMessages.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "PayPalMessages"
s.version = "1.0.0-prerelease.6"
s.version = "1.0.0-alpha.1"
s.summary = "The PayPal iOS SDK Messages Module: Promote offers to your customers such as Pay Later and PayPal Credit."
s.homepage = "https://developer.paypal.com"
s.license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion Sources/PayPalMessages/Enums/BuildInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// If any of the names are changed the CI should be updated as well.
public enum BuildInfo {
/// Library version
public internal(set) static var version: String = "1.0.0-prerelease.6"
public internal(set) static var version: String = "1.0.0-alpha.1"
/// Message rendering environment
public static let integrationType: String = "NATIVE_IOS"
/// Default message content channel
Expand Down
169 changes: 104 additions & 65 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,73 +158,102 @@ platform :ios do

desc "Update version number in various files"
lane :release do |options|
if options[:version]
# Update the hardcoded version string in the Swift code
build_info_path = sh "find .. -name 'BuildInfo.swift'"
sh "sed -i '' -E 's/version(.*) = \"[0-9a-zA-Z.-]+\"/version\\1 = \"#{options[:version]}\"/' #{build_info_path}"

# Update the version in the podspec file
version_bump_podspec(
path: "PayPalMessages.podspec",
version_number: options[:version]
)
return unless options[:version]

version_bump_carthage(
path: "Carthage/PayPalMessages.json",
version_number: options[:version]
)
# Update the hardcoded version string in the Swift code
build_info_path = sh "find .. -name 'BuildInfo.swift'"
sh "sed -i '' -E 's/version(.*) = \"[0-9a-zA-Z.-]+\"/version\\1 = \"#{options[:version]}\"/' #{build_info_path}"

sh "rm -rf ../build"

ENV["CODE_SIGN_IDENTITY"] = ""
ENV["CODE_SIGNING_REQUIRED"] = "NO"
ENV["CODE_SIGN_ENTITLEMENTS"] = ""
ENV["CODE_SIGNING_ALLOWED"] = "NO"

xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphoneos",
archive_path: "./build/Archives/Device.xcarchive"
)
# Update the version in the podspec file
version_bump_podspec(
path: "PayPalMessages.podspec",
version_number: options[:version]
)

xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphonesimulator",
archive_path: "./build/Archives/Simulator.xcarchive"
)
version_bump_carthage(
path: "Carthage/PayPalMessages.json",
version_number: options[:version]
)

# Set global env that will be used in the next xcodebuild command
ENV["EXCLUDED_ARCHS"] = "arm64"

# For the older universal framework asset the device and simulator must be built separately due to conflicting architectures.
# Both the device and simulator include amd64 architecture which is incompatible with `lipo`, so arm64 is excluded from the
# simulator so that the binaries can be combined
xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphonesimulator",
archive_path: "./build/Archives/Simulator-NoArm64.xcarchive"
)
sh "rm -rf ../build"

create_xcframework(
frameworks: [
"build/Archives/Device.xcarchive/Products/Library/Frameworks/PayPalMessages.framework",
"build/Archives/Simulator.xcarchive/Products/Library/Frameworks/PayPalMessages.framework"
],
output: "build/PayPalMessages.xcframework"
)
# Manual codesigning below
ENV["CODE_SIGN_IDENTITY"] = ""
ENV["CODE_SIGNING_REQUIRED"] = "NO"
ENV["CODE_SIGN_ENTITLEMENTS"] = ""
ENV["CODE_SIGNING_ALLOWED"] = "NO"

xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphoneos",
archive_path: "./build/Archives/Device.xcarchive"
)

xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphonesimulator",
archive_path: "./build/Archives/Simulator.xcarchive"
)

# Set global env that will be used in the next xcodebuild command
ENV["EXCLUDED_ARCHS"] = "arm64"

# For the older universal framework asset the device and simulator must be built separately due to conflicting architectures.
# Both the device and simulator include amd64 architecture which is incompatible with `lipo`, so arm64 is excluded from the
# simulator so that the binaries can be combined
xcodebuild(
archive: true,
clean: true,
project: "PayPalMessages.xcodeproj",
scheme: "PayPalMessages",
configuration: "Release",
sdk: "iphonesimulator",
archive_path: "./build/Archives/Simulator-NoArm64.xcarchive"
)

create_xcframework(
frameworks: [
"build/Archives/Device.xcarchive/Products/Library/Frameworks/PayPalMessages.framework",
"build/Archives/Simulator.xcarchive/Products/Library/Frameworks/PayPalMessages.framework"
],
output: "build/PayPalMessages.xcframework"
)


temp_dir = ENV["RUNNER_TEMP"] || ENV["TMPDIR"]
ENV["CERTIFICATE_PATH"] = "#{temp_dir}/distribution_certificate.p12"
ENV["KEYCHAIN_PATH"] = "#{temp_dir}/distribution.keychain-db"

# Import base64 certificate to file
sh "echo $DISTRIBUTION_CERTIFICATE_BASE64 | base64 --decode -o $CERTIFICATE_PATH"

# Create new keychain to import distribution certificate
create_keychain(
path: ENV["KEYCHAIN_PATH"],
password: ENV["KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 21600,
lock_when_sleeps: true
)

# Import certificate to keychain
import_certificate(
certificate_path: ENV["CERTIFICATE_PATH"],
certificate_password: ENV["DISTRIBUTION_CERTIFICATE_PASSWORD"],
keychain_path: ENV["KEYCHAIN_PATH"],
keychain_password: ENV["KEYCHAIN_PASSWORD"],
)

begin
# Combine device and simulator builds into single universal framework
Dir.chdir("../build") do
# Base framework
Expand All @@ -235,15 +264,25 @@ platform :ios do
sh "lipo Archives/Device.xcarchive/Products/Library/Frameworks/PayPalMessages.framework/PayPalMessages Archives/Simulator-NoArm64.xcarchive/Products/Library/Frameworks/PayPalMessages.framework/PayPalMessages -create -output PayPalMessages.framework/PayPalMessages"
# Zip up framework
sh "zip -r PayPalMessages.framework.zip PayPalMessages.framework"
# Sign xcframework with certificate
sh "codesign --timestamp -v --sign \"Braintree Payment Solutions, LLC (43253H4X22)\" PayPalMessages.xcframework"
# Zip up xcframework
sh "zip -r PayPalMessages.xcframework.zip PayPalMessages.xcframework"
end

version_bump_spm(
version_number: options[:version],
checksum_file: "build/PayPalMessages.xcframework.zip"
rescue => e
error = e # Store the exception
ensure
# Cleanup keychain from machine
delete_keychain(
keychain_path: ENV["KEYCHAIN_PATH"]
)
raise error if error # Re-raise the exception if it exists
end

version_bump_spm(
version_number: options[:version],
checksum_file: "build/PayPalMessages.xcframework.zip"
)
end

desc "Sync develop with main branch"
Expand Down

0 comments on commit 9ef181d

Please sign in to comment.