Go to file
Franco Meloni 93f67d135a
Merge pull request #31 from shibapm/update_yams
Update Yams
2019-06-13 11:51:19 -07:00
Documentation/Steps Update Steps.md 2019-01-21 22:41:27 +00:00
Sources fix optional package config decode 2019-04-19 10:44:33 +01:00
Tests Fix rocket steps decoding 2019-04-19 10:08:57 +01:00
.gitignore Initial commit 2018-11-29 14:09:10 +00:00
.swift-version Added swift-version file 2018-12-03 12:48:46 +00:00
.test.yml run rocket during the CI on a test yaml file 2018-12-10 19:26:35 +00:00
.travis.yml Remove before after step tests 2019-02-09 11:56:42 +00:00
Package.resolved Update Yams 2019-06-13 19:40:19 +01:00
Package.swift Update Yams 2019-06-13 19:40:19 +01:00
README.md Update README.md 2019-04-19 09:49:53 +01:00

README.md

Rocket 🚀

Swift CLI release tool for Git repos and Swift Packages

Installation

You can install Rocket with SPM

  1. Add or amend a Package.swift
  2. Add this dependency .package(url: "https://github.com/f-meloni/Rocket", from: "0.1.0")
  3. Then you can run swift run rocket 1.0.0 where 1.0.0 is the version that you want to release

Setup the release steps

With YAML

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

With PackageConfig (https://github.com/orta/PackageConfig) you can put the configuration at the end of your Package.swift

#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()

Default steps

If there is no step definition Rocket will run the default steps:

  • hide_dev_dependencies
  • git_add
  • commit
  • tag
  • unhide_dev_dependencies
  • git_add
  • commit (message: "Unhide dev dependencies")
  • push (remote=origin branch=master)

Before/After steps

If you use the before and/or after keys

e.g.

---
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"

  • hide_dev_dependencies

  • git_add

  • commit

  • tag

  • unhide_dev_dependencies

  • git_add

  • 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 unhide_dev_dependencies.

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:

Steps

You can find the full steps list here

Variable $VERSION

You can use the variable $VERSION inside the steps to refer to the version you are releasing

Next steps

  • Add a step to execute script files written in swift
  • Add a step to comment the dev dependencies on the Package.swift
  • Add a step to create Github releases