Swift CLI release tool for Git repos and Swift Packages
You can install Rocket with SPM
- Add or amend a Package.swift
- Add this dependency
.package(url: "https://github.com/f-meloni/Rocket", from: "0.1.0")
- Then you can run
swift run rocket 1.0.0where
1.0.0is the version that you want to release
Setup the release steps
Create a file called
.rocket.yml with your steps inside
--- steps: - script: content: ruby Scripts/update_changelog.rb - git_add: paths: - CHANGELOG.md - commit: message: "Releasing version $VERSION" - tag - push
With PackageConfig (https://github.com/orta/PackageConfig) you can put the configuration at the end of your
#if canImport(PackageConfig) import PackageConfig let config = PackageConfiguration([ "rocket": ["steps": [ ["script": ["content": "ruby Scripts/update_changelog.rb"]] ["git_add": ["paths": ["CHANGELOG.md"]]], ["commit": ["message": "Releasing version $VERSION"]], "tag", "push" ] ] ]).write()
If there is no step definition Rocket will run the default steps:
- commit (message: "Unhide dev dependencies")
- push (remote=origin branch=master)
If you use the
--- before: - script: content: echo "Testing Release for $VERSION" after: - script: content: echo "released $VERSION"
Rocket will execute the default steps between the before and after steps
echo "Testing Release for $VERSION"
commit (message: "Unhide dev dependencies")
push (remote=origin branch=master)
echo "released $VERSION"
Hide dev dependencies
When you release a package you want that who adds it as dependency downloads just the dependencies that are really needed to your package.
This is why Rocket introduces the concept of dev dependency, if you have in your package some scripts e.g. swiftformat you can add them as dev dependencies (by adding
// dev after them) and they will be commented by the
hide_dev_dependencies step and uncommented from the
That is also valid for the dependencies that are used just from test targets, but in that case you will have to add the test target as dev dependency too.
Some examples are:
You can find the full steps list here
You can use the variable
$VERSION inside the steps to refer to the version you are releasing
- [X] Add a step to execute script files written in swift
- [X] Add a step to comment the dev dependencies on the
- [ ] Add a step to create Github releases
Help us keep the lights on