Build for iOS not using toolchain in TOOLCHAINS variable

i am trying to build swift-json for iOS in its GitHub Actions CI pipeline. i have set the TOOLCHAINS environment variable with:

echo "TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw \
      $SWIFT_TOOLCHAIN_DIRECTORY/Info.plist)" >> $GITHUB_ENV

it seems to be using the correct toolchain when invoking swift directly, but the iOS build is still using the preinstalled 5.9 toolchain:

Apple Swift version 5.10 (swift-5.10-RELEASE)
Target: arm64-apple-macosx14.0
Command line invocation:
    /Applications/Xcode_15.0.1.app/Contents/Developer/usr/bin/xcodebuild build -scheme JSON -destination generic/platform=ios
User defaults from command line:
    IDEPackageSupportToolchainOverrideForManifestLoading = org.swift.5101202403041a
    IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
    TOOLCHAINS = org.swift.5101202403041a
Resolve Package Graph
package 'swift-json' is using Swift tools version 5.10.0 but the installed version is 5.9.0
Resolved source packages:
  swift-json: /Users/runner/work/swift-json/swift-json
2024-03-15 18:11:22.317 xcodebuild[2555:12949] Writing error result bundle to /var/folders/1k/qq3pcbf12vb6vyblh81736p40000gn/T/ResultBundle_2024-15-03_18-11-0022.xcresult
Resolve Package Graph
2024-03-15 18:11:23.256 xcodebuild[2555:12949] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22269/IDEFoundation/Execution/RunContextManager/IDERunContextManager.m:847
Details:  Error deleting scheme: Cannot modify data because the process disallows saving.
package 'swift-json' is using Swift tools version 5.10.0 but the installed version is 5.9.0
Object:   <IDERunContextManager: 0x6000019c8a00>
Method:   -deleteRunContexts:completionQueue:completionBlock:
Thread:   <_NSMainThread: 0x600003dcc280>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2024-03-15 18:11:23.257 xcodebuild[2555:12949] could not delete old scheme: Error Domain=DVTCustomDataStoringErrors Code=0 "Cannot modify data because the process disallows saving." UserInfo={NSLocalizedDescription=Cannot modify data because the process disallows saving.}
xcodebuild: error: Could not resolve package dependencies:
  package 'swift-json' is using Swift tools version 5.10.0 but the installed version is 5.9.0

here is how i am invoking the build:

run: |
    swift --version
    xcrun xcodebuild build -scheme "JSON" -destination \
        "generic/platform=ios"
    xcrun xcodebuild build -scheme "JSONLegacy" -destination \
        "generic/platform=ios"

what am i doing wrong?

Toolchains aren't usable for loading packages in Xcode, they are always loaded using a built-in version of libSwiftPM.

understood, thanks. do you have a recommendation for testing iOS builds in GitHub Actions CI?