Swiftlane contains a set of build utilities to speed up iOS and macOS development and deployment
There's no additional configuration file, your Swift script file is the source of truth. With auto completion and type safety, you are ensured to do the right things in Swiftlane.
- Swiftlane and its dependencies are written in pure Swift, making it easy to read and contribute.
- Use latest Swift features like async/await to enable declarative syntax
- Type-safe. All required and optional arguments are clear.
- No configuration file. Your Swift script is your definition.
- Simple wrapper around existing tools like xcodebuild, instruments and agvtool
- Reuse awesome Swift scripting dependencies from Swift community
Swiftlane is intended to be used as a Swift Package. Please consult Examples
folder for ways to integrate
- CLI: make a macOS Command Line Tool project
- Script: make an executable Swift Package
import Swiftlane
import AppStoreConnect
@main
struct Script {
static func main() async throws {
try await deployMyApp()
}
private static func deployMyApp() async throws {
var workflow = Workflow()
workflow.directory = Settings.fs
.homeDirectory()
.appendingPathComponent("Projects/swiftlane/Examples/MyApp")
workflow.xcodeApp = URL(string: "/Applications/Xcode.app")
let build = Build()
build.project("MyApp")
build.allowProvisioningUpdates()
build.destination(platform: .iOSSimulator, name: "iPhone 13")
build.workflow = workflow
try await build.run()
guard
let issuerId = Settings.env["ASC_ISSUER_ID"],
let privateKeyId = Settings.env["ASC_PRIVATE_KEY_ID"],
let privateKey = Settings.env["ASC_PRIVATE_KEY"]
else { return }
let asc = try ASC(
credential: AppStoreConnect.Credential(
issuerId: issuerId,
privateKeyId: privateKeyId,
privateKey: privateKey
)
)
try await asc.fetchCertificates()
try await asc.fetchProvisioningProfiles()
let keychain = try await Keychain.create(
path: Keychain.Path(
rawValue: Settings.fs
.downloadsDirectory
.appendingPathComponent("custom.keychain")),
password: "keychain_password"
)
try await keychain.unlock()
try await keychain.import(
certificateFile: Settings.fs
.downloadsDirectory
.appendingPathComponent("abcpass.p12"),
certificatePassword: "123"
)
}
}
- Build: build project
- Test: test project
- Archive: archive project
- ExportArchive: export archive
- AppStore Connect: use https://github.com/onmyway133/AppStoreConnect
- GetBuildSettings: get project build settings
- GenerateIcon: generate app icon set
- Screenshot: take screenshot
- Frame: frame screenshot
- UploadASC: upload IPA to AppStore Connect
- Fetch certificates
- Fetch provisioning profiles
- Save certificates into file system
- Save profiles into file system
- Install provisioning profile
- Fetch TestFlight versions
- Fetch TestFlight builds
- Fetch latest TestFlight build number
- Set version
- Set build number
- Increment build number
- Create custom keychain
- Unlock keychain
- Delete keychain
- List searchable keychain paths
- Add keychain to searchable paths
- Import certificate into keychain
- Boot a simulator
- Update and style simulator
- Print current Xcode path
- Notarize: notarize project
- MakeDMG: package as DMG
- Sparkle: update Spackle Appcast file
- Slack: send message to a Slack channel
- RunScript: run arbitrary script
- PrintWorkingDirectory: print current working directory
- S3: upload to S3
- Setapp: upload to Setapp
- Download: download file
- MoveFile: move file
- CopyFile: copy file
- AppCenter: use appcenter-cli
Configurations via Settings
- Console: log to console
- FileSystem: interact with file system
- Environment: read environment values
- CommandLine: run command line tools
- Notarize: refactor from https://github.com/Mortennn/Notarize
Swiftlane is released under the MIT license. See LICENSE for details.