Git Product home page Git Product logo

rocket's Introduction

Rocket ๐Ÿš€

Swift CLI release tool for Git repos and Swift Packages

Install Rocket

You can install Rocket with SPM

  1. Add or amend a Package.swift
  2. Add this dependency .package(url: "https://github.com/shibapm/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

Set up 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 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

rocket's People

Contributors

417-72ki avatar f-meloni avatar leogdion avatar lucianopalmeida avatar orta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rocket's Issues

Support not steps

Linking ./.build/x86_64-apple-macosx10.10/debug/rocket
ERROR: Steps not found
Fatal error: Unexpectedly found nil while unwrapping an Optional value
fish: 'swift run rocket 1.0.2' terminated by signal SIGILL (Illegal instruction)

I dunno if I need any steps at all for my default run, just remove // dev, git tag etc so I tried without it first :D

Xcode 12/Swift 5.3 Crash

from: brightdigit/OrchardNest@c79770c

โžœ  OrchardNest git:(main) โœ— swift run rocket 0.2.0
Stack dump:
0.	Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Bash.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Command.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Context.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/FileHandle.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Files.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/General/Array.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Process.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Stream/Lazy-split.swift -primary-file /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/String.swift -emit-module-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream~partial.swiftmodule -emit-module-doc-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream~partial.swiftdoc -emit-module-source-info-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream~partial.swiftsourceinfo -emit-dependencies-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream.d -emit-reference-dependencies-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream.swiftdeps -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -I /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug -I /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 4 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-anonymous-context-mangled-names -target-sdk-version 11.0 -parse-as-library -module-name SwiftShell -o /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/SwiftShell.build/Stream/Stream.swift.o -index-store-path /Users/leo/Documents/Projects/OrchardNest/.build/x86_64-apple-macosx/debug/index/store -index-system-modules 
1.	Apple Swift version 5.3 (swiftlang-1200.0.25.2 clang-1200.0.27.1)
2.	While evaluating request TypeCheckSourceFileRequest(source_file "/Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift")
3.	While type-checking 'FileHandleStream' (at /Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:207:8)
4.	While type-checking protocol conformance to 'TextOutputStreamable' (in module 'Swift') for type 'FileHandleStream' (declared at [/Users/leo/Documents/Projects/OrchardNest/.build/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:207:8 - line:215:1] RangeText="class FileHandleStream: ReadableStream, WritableStream {
	public let filehandle: FileHandle
	public var encoding: String.Encoding

	public init(_ filehandle: FileHandle, encoding: String.Encoding) {
		self.filehandle = filehandle
		self.encoding = encoding
	}
")
0  swift                    0x000000010888b345 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010888a345 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010888b8ff SignalHandler(int) + 111
3  libsystem_platform.dylib 0x00007fff6c3405fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338700814880
5  swift                    0x000000010513f79b swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 779
6  swift                    0x000000010512f350 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 14960
7  swift                    0x000000010513a635 swift::constraints::ConstraintSystem::repairFailures(swift::Type, swift::Type, swift::constraints::ConstraintKind, llvm::SmallVectorImpl<swift::constraints::RestrictionOrFix>&, swift::constraints::ConstraintLocatorBuilder) + 12677
8  swift                    0x000000010512f2e5 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 14853
9  swift                    0x000000010512f709 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 15913
10 swift                    0x0000000105154170 swift::constraints::ConstraintSystem::addConstraintImpl(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) + 96
11 swift                    0x000000010512b0e2 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) + 66
12 swift                    0x000000010535b58d llvm::Optional<swift::RequirementMatch> llvm::function_ref<llvm::Optional<swift::RequirementMatch> (swift::Type, swift::Type)>::callback_fn<swift::matchWitness(llvm::DenseMap<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment, llvm::DenseMapInfo<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*> >, llvm::detail::DenseMapPair<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment> >&, swift::ProtocolDecl*, swift::ProtocolConformance*, swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*)::$_1>(long, swift::Type, swift::Type) + 93
13 swift                    0x000000010533c99a swift::matchWitness(swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*, llvm::function_ref<std::__1::tuple<llvm::Optional<swift::RequirementMatch>, swift::Type, swift::Type> ()>, llvm::function_ref<llvm::Optional<swift::RequirementMatch> (swift::Type, swift::Type)>, llvm::function_ref<swift::RequirementMatch (bool, llvm::ArrayRef<swift::OptionalAdjustment>)>) + 8778
14 swift                    0x000000010533e4d3 swift::matchWitness(llvm::DenseMap<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment, llvm::DenseMapInfo<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*> >, llvm::detail::DenseMapPair<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment> >&, swift::ProtocolDecl*, swift::ProtocolConformance*, swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*) + 1187
15 swift                    0x000000010533f022 swift::WitnessChecker::findBestWitness(swift::ValueDecl*, bool*, swift::NormalProtocolConformance*, llvm::SmallVectorImpl<swift::RequirementMatch>&, unsigned int&, unsigned int&, bool&) + 946
16 swift                    0x0000000105349693 swift::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 643
17 swift                    0x0000000105344575 swift::MultiConformanceChecker::checkIndividualConformance(swift::NormalProtocolConformance*, bool) + 14773
18 swift                    0x0000000105340663 swift::MultiConformanceChecker::checkAllConformances() + 147
19 swift                    0x00000001053501e7 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 8295
20 swift                    0x00000001053005fa (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) + 8138
21 swift                    0x00000001052f8af3 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2739
22 swift                    0x00000001053c0181 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 753
23 swift                    0x00000001053c3009 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 953
24 swift                    0x00000001053bfd04 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 164
25 swift                    0x000000010453e80b swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 6859
26 swift                    0x00000001043ff7ad swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6845
27 swift                    0x0000000104384107 main + 1255
28 libdyld.dylib            0x00007fff6c147cc9 start + 1

No License

Hello,

this project has no license information. A repo wide search for "copyright" also yielded no results. This most probably is just an oversight? Could you please add a license so everybody can use, share and modify the code? You might want to take a look at this page for more information: https://choosealicense.com/no-permission/

Thanks in advance,
Andy

hide_prod_dependencies / hide_other_dependencies / etc

I think I encountered a scenario where it would be useful to have an additional flag beyond // dev for other dependencies, Possibly prod would be a good start, but maybe it could be more flexible and support like hide_${whatever}_dependencies for anything tagged // whatever. I have been prototyping a Swift Package for OpenCV, which uses a binary xcframework dependency. Normally it will point to a remote URL for a tagged release, but if you want to run swift test against local changes, you'd need to comment out the binaryTarget url/checksum and use a local path version instead.

        // Recompute checksum via `swift package --package-path /path/to/opencv compute-checksum /path/to/opencv2.xcframework.zip`
//        .binaryTarget(
//            name: "opencv2",
//            url: "https://github.com/Rightpoint/opencv/releases/download/4.5.1/opencv2-4.5.1-dynamic.xcframework.zip",
//            checksum: "48273710fe03eb6d6a77ca57f96ef7917db395e6c3bc62e2b495df3dc8f1a0a9"
//        ),
        // If you are compiling OpenCV locally, you can uncomment the below block to use a custom copy
        // e.g. `$ python platforms/apple/build_xcframework.py --dynamic build/dynamic-xcframework`
        .binaryTarget(
            name: "opencv2",
            path: "build/dynamic-xcframework/opencv2.xcframework"
        ),

This seems like the perfect candidate for that scenario.

Does this sound like a feature you'd consider merging? And, if so, could someone point me in the right direction for hacking on this? Thanks!

Add `branch` step

Hi, it would be great to have a step which creates a new branch with a given name.
Few package managers (see Mint for example) uses branches instead of tags to fetch a specific version of the package

Log the tag when it is generated via the arg (like patch)

โฏ swift run rocket patch
โœ” hide_dev_dependencies (packagePath=Package.swift)
โœ” git_add (paths=["."])
โœ” commit
โœ” tag
โœ” unhide_dev_dependencies (packagePath=Package.swift)
โœ” git_add (paths=["."])
โœ” commit (message=Unhide dependencies)
โœ” push (remote=origin branch=HEAD)

Done in 9.4480s

Would ideally have said:

โœ” tag 1.2.1

Support version prefix

Building off #22, what are your thoughts on either providing an option or inferring a version prefix from the latest tags? (e.g. v from v1.1.0).

Also, adding the version bump inference to the docs would be helpful.

I'd be happy to contribute to either if you want/open to PR's.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.