Automate Versioning with Fastlane's New Action
If you are a Cocoapods framework maintainer or SPM library creator, this article is for you! Switching from Cocoapods to Swift Package Manager (SPM) is becoming more and more common among third-party solutions. Fastlane, a popular tool for automating testing, building, and releasing work, now offers a new action to simplify the versioning process when using SPM.
While Cocoapods requires multiple actions for versioning, SPM simplifies the process by eliminating the need for a version in Package.swift and a repository of existing libraries. Instead, SPM relies on git tag counts.
To address the lack of easy-to-use actions for versioning in SPM, the author of this article created a new Fastlane Action called "get_new_version". This action retrieves the last git tag and calculates a new version based on user-specified options. It can be used to automate the release process, ensuring accuracy and eliminating human error.
To create the "get_new_version" Fastlane Action, simply run bundle exec fastlane new_action
and follow the prompts. The resulting code file can be customized to fit your specific needs.
With Fastlane's new action, developers can streamline the versioning process when using SPM, making it easier to manage and release their work.