Skip to content

build: CocoaPods and SwiftPM - #58

Merged
V3RON merged 4 commits into
mainfrom
claude/appduct-package-publishing-7514be
Sep 16, 2026
Merged

V3RON merged 4 commits into
mainfrom
claude/appduct-package-publishing-7514be

Conversation

@V3RON

@V3RON V3RON commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Makes AppductCore publishable to CocoaPods and SwiftPM, and automates both on release. Maven Central is untouched and remains an ops task.

Why

Three of the four documented native install paths did not work:

Channel Before After
SwiftPM README pointed at 0.8.0, which predates the root Package.swift — no tag at or below it has a manifest floor corrected to 0.9.0; publishing is the release tag, already automatic
CocoaPods not on trunk, and the podspec could not have been pushed — see below lints clean; pushed by CI on release
Maven Central not published unchanged — still an ops task
npm working unchanged

The podspec was broken

pod lib lint gave two hard errors. The interesting one: source_files read ios/Sources/AppductCore/... while the podspec sat in packages/native/ios/, resolving to a doubled ios/ios/ path that matched zero files. For a trunk pod that is worse than a typo — CocoaPods clones s.source and resolves file patterns against the root of the cloned repository, not the podspec's directory, so the paths had to be root-relative either way.

Hence the move to the repo root, next to Package.swift, which lives there for the identical reason. s.source also had no :tag (nothing to clone) and no reachable license file.

Also raises swift_version from '5.9' to '6.0'. -swift-version accepts only 4, 4.2, 5 and 6, so '5.9' never reached the compiler verbatim — Xcode normalised it down to mode 5, quietly building the pod under laxer rules than SwiftPM, which compiles the same sources at -swift-version 6 (confirmed from the compile line).

The new job

publish-cocoapods runs last, after every npm publish has succeeded. A trunk version is permanent — no pod trunk unpublish, and a version can never be reused — whereas npm unpublish works for 72 hours. So the irreversible half of a release only runs once the reversible half is known good.

It is re-run safe (queries the trunk API, skips a version already published) and verifies the release tag is fetchable before pushing, since pod trunk push clones the tag rather than uploading the working tree.

SwiftPM needed no publishing step: it releases off the git tag, which a published GitHub release already guarantees is on the remote.

Verification

  • pod lib lint AppductCore.podspec --platforms=ios — passes, building the pod and its test spec, at both mode 5 and mode 6
  • xcodebuild -scheme AppductCore -destination 'generic/platform=iOS' against the root Package.swift — ** BUILD SUCCEEDED **, so the SPM install path this PR documents genuinely works
  • Trunk-presence check exercised against the live API: AppductCore@0.9.0 → 404/not-published, Alamofire@5.9.0 → published, Alamofire@99.0.0 → not published
  • Tag guard exercised against the real remote: v0.8.0 resolves, v0.9.0 does not — exactly the case it exists to catch
  • actionlint clean on the new job (the two SC2016 infos it reports are pre-existing on package)
  • check:links passes across 39 files

tvOS lint is unverified — the podspec declares ios and tvos and trunk validates both, but this machine has no tvOS simulator runtime. GitHub's macOS images normally ship one; that is reasoning, not a measurement, and it is the likeliest way the job fails on its first real run.

Before this can run

  1. pod trunk register and confirm by email
  2. Create a cocoapods environment with a COCOAPODS_TRUNK_TOKEN secret
  3. Push v0.9.0 and cut the release

Follow-ups

@V3RON V3RON changed the title Make AppductCore publishable to CocoaPods and SwiftPM, and automate both on release build: CocoaPods and SwiftPM Sep 16, 2026
The podspec could not have been pushed to CocoaPods trunk as it stood.
`pod lib lint` reported two hard errors and a warning:

- `source_files` matched zero files. It read `ios/Sources/AppductCore/...`
  while the podspec sat *in* `packages/native/ios/`, resolving to a
  doubled `ios/ios/` path. For a trunk pod it is worse than a typo:
  CocoaPods clones `s.source` and resolves file patterns against the root
  of the cloned repository, not the podspec's own directory.
- `s.source` carried no `:tag`, so there was no revision to clone.
- No license file was reachable from the pod root.

Move the podspec to the repo root, next to Package.swift, which is there
for the identical reason. Paths are now spelled from the root, which is
both what trunk resolves against and what `pod lib lint` checks in place,
so the two agree.

Also raise `swift_version` from '5.9' to '6.0'. `-swift-version` accepts
only 4, 4.2, 5 and 6, so '5.9' was never passed through verbatim -- Xcode
normalised it down to mode 5, quietly building the pod under laxer rules
than SwiftPM, which compiles these same sources at `-swift-version 6`.

Verified: `pod lib lint --platforms=ios` passes, building both the pod and
its test spec.
`deploy.yaml` published the three npm packages and nothing else, so the
iOS artifacts had to be pushed by hand. Add a `publish-cocoapods` job.

SwiftPM needed no work: it releases off the git tag, which a published
GitHub release already guarantees is on the remote. What that did need was
a guard -- `pod trunk push` clones `s.source` at `tag: v#{version}` rather
than uploading the working tree, and a tag missing from the remote fails
deep inside CocoaPods' downloader with an opaque git error. The job checks
that precondition up front, where the message can say what is wrong.

The job runs last, after every npm publish has succeeded. A trunk version
is permanent -- there is no `pod trunk` unpublish and a version can never
be reused -- while `npm unpublish` works for 72 hours, so the irreversible
half of a release only runs once the reversible half is known good. It is
also re-run safe: it queries the trunk API and skips a version already
published, so re-running a partially-failed deploy does not fail on a
duplicate push.

Needs a COCOAPODS_TRUNK_TOKEN secret in a `cocoapods` environment;
CocoaPods has no OIDC equivalent to npm's trusted publishing.

`--allow-warnings` is required for now, tracked in #57.
The install snippets pointed at 0.8.0, which predates the root
Package.swift -- no tag at or below it has a Swift manifest, so the
documented line could not resolve. 0.9.0 is the first release that
carries one.

Note in passing that `from:` is a floor rather than a pin: SwiftPM's
`.upToNextMajor` keys on the major component alone, so this accepts every
later 0.x release and needs no edit per release.
#59 fixed the three strict-concurrency warnings that forced the flag, and
added an iOS-destination build to test.yaml with warnings-as-errors. With
that gate in place a new warning fails on the PR that introduces it, so
trunk validation can be strict here without turning a release into the
first place anyone finds out.

Verified: `pod lib lint AppductCore.podspec --platforms=ios` passes on this
branch with no --allow-warnings.

Note the iOS gate does not cover tvOS, which the podspec also declares and
trunk also validates.
@V3RON
V3RON force-pushed the claude/appduct-package-publishing-7514be branch from 7ee520c to a81976e Compare September 16, 2026 07:29
@V3RON

V3RON commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #59 merged (clean, no conflicts), and dropped --allow-warnings from the trunk push in a81976e.

That flag was the one thing keeping trunk validation from being a real gate. It is now safe to remove because #59 added an iOS-destination build to test.yaml with SWIFT_TREAT_WARNINGS_AS_ERRORS=YES, so a new warning fails on the PR that introduces it rather than during a release.

Re-verified on the rebased branch: pod lib lint AppductCore.podspec --platforms=ios passes with no flag.

Still unverified: tvOS. The podspec declares it and trunk validates it, but the new CI gate covers iOS only and this machine has no tvOS simulator runtime.

@V3RON
V3RON merged commit f69911b into main Sep 16, 2026
8 checks passed
@V3RON
V3RON deleted the claude/appduct-package-publishing-7514be branch September 16, 2026 08:21
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.

1 participant