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

CocoaPods Support #132

Merged
merged 8 commits into from
Oct 6, 2023
Merged

CocoaPods Support #132

merged 8 commits into from
Oct 6, 2023

Conversation

mgacy
Copy link
Contributor

@mgacy mgacy commented Oct 2, 2023

Adds support for distribution through CocoaPods.

  • Adds a podspec for the core library named LyticsSDK I chose this as Lytics is already taken, but I am open to any alternative name.
  • Adds a podspec for the UI library named LyticsUI

I used separate podspecs rather than subspecs as the latter generates a single target for the different subspecs rather than separate Lytics and LyticsUI targets.

Attention should be paid to my choice of values for the different settings like s.homepage and s.social_media_url.

The next PR will include changes to the tag-release workflow to automate publishing the podspecs. I am submitting that separately to ensure that any potential CI issues do not disrupt other work that depends on the published podspecs.


Post-Merge Configuration

Once this PR is merged and tagged -- this tag will need to be created manually rather than with the Release workflow if we use 0.0.1 -- the podspecs will need to be published to the CocoaPods ‘Trunk’ web-service. As this involves a claim of ownership it should be performed by someone from Lytics. The process to do this is as follows:

Install CocoaPods:

The documentation suggests installing CocoaPods using gem; if using the default Ruby install on macOS you will need to use sudo when installing:

$ sudo gem install cocoapods

Alternatively, it is available through homebrew (brew install cocoapods).

Create Account

Documentation: Getting setup with Trunk

Register for an account:

$ pod trunk register <email> '<name>' [--description='<session description>']

Trunk accounts do not have passwords, only per-computer session tokens; you must click a link in an email Trunk sends you to verify the connection between your Trunk account and the current computer. Note that when I tried this on 2023/10/02 I saw erroneous error messages on the verification page. After clicking the link in the email verify your session by running pod trunk me.

Publish Specs

The podspecs use the LIB_VERSION environment variable for the version number, so set that first (using whatever version number we use; a normal rather than pre-release version number would be preferable):

$ export LIB_VERSION=0.0.1

Publish the core spec by running the following from the repo's root directory:

$ pod trunk push LyticsSDK.podspec --use-json

Then, publish the UI spec:

$ pod trunk push LyticsUI.podspec --use-json

Obtain Cocoapods Token

Get the token for an account session for use with GitHub actions; you can separate the CI session from the one created above by first running pod trunk register to create a new one.

$ grep -A2 'trunk.cocoapods.org' ~/.netrc

The results should look like:

machine trunk.cocoapods.org
 login <[email protected]>
 password <TOKEN>

Then, add the token as the value for the COCOAPODS_TRUNK_TOKEN secret in the repo's settings (the secret has already been created with a placeholder value).

@mgacy mgacy marked this pull request as ready for review October 2, 2023 16:25
@mgacy mgacy merged commit 3d4a9e7 into main Oct 6, 2023
1 check passed
@mgacy mgacy deleted the refactor/cocoapods-support branch October 6, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants