Skip to content

Swift Package Registry ​

SwiftPM uses scope.name to identify packages and requests versions, manifests, and ZIP archives through the SE-0292 registry API. Publishing and login require production HTTPS.

Create repositories ​

Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the endpoint and upstream address. Grant the publisher Hosted write access and the consumer read access to Group and the relevant members. For each identity, sign in and run arkactl --json tokens create --name swift-ci --expires-in-days 30 | jq -er .plaintext. Store each token directly in your secret manager.

bash
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name swift-hosted --type hosted --format swift | jq -er .id)
proxy=$(arkactl --json repo create --name swift-proxy --type proxy --format swift \
  --upstream-url https://swift-registry.example.org | jq -er .id)
arkactl repo create --name swift-group --type group --format swift --member "$hosted,$proxy"
export WRITE="$ARKA_URL/repository/swift-hosted"
export READ="$ARKA_URL/repository/swift-group"

Sign in and publish ​

bash
swift package-registry login "$WRITE/login" --username "$ARKA_PUBLISH_USER"
swift package-registry publish acme.widget 1.2.3 --url "$WRITE"

Use the Arka write token as the Basic password. For noninteractive CI login, inject the credentials using SwiftPM’s options and isolate the .netrc or system keychain. Keep arguments out of logs. The project must have a valid root Package.swift. Arka supports SwiftPM 6.2.4 multipart publishing and also accepts ZIP uploads using these commands.

bash
swift package archive-source --output acme-widget-1.2.3.zip
curl --fail-with-body -sS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
  -T acme-widget-1.2.3.zip "$WRITE/acme/widget/1.2.3"

Resolve dependencies ​

bash
swift package-registry set --scope acme "$READ"
swift package resolve
swift
.package(id: "acme.widget", exact: "1.2.3")

For private reads, log in separately to "$READ/login" with a read token. SwiftPM stores authentication by registry host. Use separate CI homes or account profiles when switching read and write identities on the same host. Group resolves Hosted and Proxy versions. Set the Proxy upstream to the Swift Package Registry root URL.

SymptomWhat to check
Registry login failsCheck the HTTPS trust chain, full /login path, and Basic credentials.
Upload returns 400Check the ZIP root, manifest, and SwiftPM multipart fields.
resolve failsRetry from a clean project and cache. Inspect version JSON, API version header, .zip, and Digest.

SwiftPM registry login · Swift registry publishing

Released under the Apache 2.0 License.