Deploy Swift Packages

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Note

Swift packages must be deployed according to the following structure, otherwise they will not be indexed:

  • <SCOPE>/<NAME>/<NAME>-<VERSION>.zip

  • <SCOPE>/<NAME>/<VERSION>

  1. From the root directory of the package, run this command to create a source archive for the working tree:

    swift package archive-source
  2. Publish the archive using one of the following commands, based on your version of the Swift client:

    • Version 5.9 or later:

      swift package-registry publish <SCOPE>.<NAME> <VERSION>

      Where:

      • <SCOPE>: The owner or namespace of the package, usually the scope of the source code repository URL

      • <NAME>: The name of the project as defined in the Package.swift file

      • <VERSION>: The version of the package, usually corresponding with a tag in the source code repository

      For example:

      swift package-registry publish aurora-fi.aurora-auth-ios 2.1.4
    • Version 5.8 or earlier:

      curl -X PUT -u<USERNAME>:<AUTH> \
      -H "Accept: application/vnd.swift.registry.v1+json" \
      -F source-archive="@<SOURCE_ARCHIVE_PATH>" \
      https://[JFrogPlatformURL]/artifactory/api/swift/<REPO_NAME>/<SCOPE>/<NAME>/<VERSION>

      Where:

      • <USERNAME>: Your Artifactory username

      • <AUTH>: Your Artifactory identity token or secure password

      • <SOURCE_ARCHIVE_PATH>: The local file path to the source archive for the package

      • [JFrogPlatformURL]: The URL of your JPD

      • <REPO_NAME>: The name of the target repository in Artifactory

      • <SCOPE>: The owner or namespace of the package, usually the scope of the source code repository URL

      • <NAME>: The name of the project as defined in the Package.swift file

      • <VERSION>: The version of the package, usually corresponding with a tag in the source code repository

      For example:

      curl -X PUT -ujeffry:B7r9P2tLqGvXzWcM5jN3yHkF6sD8aA1vS4uK0eI2oZp7xTqWcE5rVbN1mKjHgF \
      -H "Accept: application/vnd.swift.registry.v1+json" \
      -F source-archive="@/opt/build/agent/work/aurora-auth-ios-2.1.4.zip" \
      https://company.jfrog.io/artifactory/api/swift/swift-releases/aurora-fi/aurora-auth-ios/2.1.4

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.