diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..10be95a --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +# +# Run help command as the default. +# +all: help + +# +# Shows help message. +# +.PHONY: help +help: + @echo 'To release a version of SwinjectStoryboard, run the following commands in order on the branch where you make a release.' + @echo ' $$ make VERSION= set-new-version (e.g. make VERSION=1.2.3 set-new-version)' + @echo ' $$ make [UPSTREAM=] push-to-upstream (e.g. make push-to-upstream)' + @echo ' $$ make carthage-release' + @echo ' $$ make cocoapods-release' + +# +# Set a specified version in Info.plist and podspec files, and tag the version. +# +.PHONY: set-new-version +set-new-version: +ifndef VERSION + $(error Specify a new version. E.g. $$ make VERSION=1.2.3 set-new-version) +endif +ifeq ($(wildcard ./SwinjectStoryboard.podspec),) + $(error Run the command in the directory containing SwinjectStoryboard.podspec.) +endif +ifeq ($(shell git diff --quiet; echo $$?), 1) + $(error Your current git working tree is dirty. Stash all to run this command.) +endif + agvtool new-marketing-version $(VERSION) + sed -i '' -e 's/\(s\.version.*=\).*/\1 "$(VERSION)"/' ./SwinjectStoryboard.podspec + git commit -a -m "Update the version to $(VERSION)" + git tag $(VERSION) + +# +# Push the commit and tag for the new version to upstream. +# +VERSION_TAG=$(shell git describe --abbrev=0) +ifndef UPSTREAM +UPSTREAM=upstream +endif +.PHONY: push-to-upstream +push-to-upstream: + git push $(UPSTREAM) $(shell git branch --show-current) + git push $(UPSTREAM) $(VERSION_TAG) + +# +# Make a release for Carthage. +# +VERSION_TAG=$(shell git describe --abbrev=0) +.PHONY: carthage-release +carthage-release: +ifeq ($(shell which gh),) + $(error gh command not found. Install gh command and run `gh auth login` beforehand.) +endif +ifneq ($(VERSION_TAG),$(shell agvtool what-marketing-version -terse1)) + $(error The version tag $(VERSION_TAG) does not match the version in Info.plist) +endif + gh release create v$(VERSION_TAG) --draft + @echo Open https://github.com/Swinject/SwinjectStoryboard/releases/edit/$(VERSION_TAG) to describe the release and publish it. + +# +# Make a release for Cocoapods. +# +.PHONY: cocoapods-release +cocoapods-release: + pod lib lint + pod trunk push SwinjectStoryboard.podspec diff --git a/README.md b/README.md index 7309ff7..173f101 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,12 @@ container.register(Animal.self) { _ in Cat(name: "Mimi") } If you implicitly instantiate `UIWindow` and its root view controller, the registrations setup for "Main" storyboard can be shared with the referenced storyboard since `defaultContainer` is configured in `setup` method. +## For Maintainers + + ### Making a new release version + + Our release procedure is described as [Makefile](https://github.com/Swinject/SwinjectStoryboard/blob/master/Makefile). Run `make help` coomand for more info. + ## Credits SwinjectStoryboard is inspired by: diff --git a/SwinjectStoryboard.xcodeproj/project.pbxproj b/SwinjectStoryboard.xcodeproj/project.pbxproj index e39d386..7442c82 100644 --- a/SwinjectStoryboard.xcodeproj/project.pbxproj +++ b/SwinjectStoryboard.xcodeproj/project.pbxproj @@ -290,6 +290,7 @@ CDA864B11EA9F28E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = ""; }; CDA864B41EA9F29E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/tvOS/Nimble.framework; sourceTree = ""; }; CDA864B51EA9F29E00293FEC /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/tvOS/Quick.framework; sourceTree = ""; }; + FF0BC8F226920979000E4FE6 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SwinjectStoryboard+SetUp.m"; sourceTree = ""; }; FF492DAF1EDA65D90081A4A7 /* NSStoryboard+Swizzling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSStoryboard+Swizzling.h"; sourceTree = ""; }; FF492DB01EDA65D90081A4A7 /* NSStoryboard+Swizzling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSStoryboard+Swizzling.m"; sourceTree = ""; }; @@ -431,6 +432,7 @@ 985903FC1CDB0AA700275E4A = { isa = PBXGroup; children = ( + FF0BC8F226920979000E4FE6 /* README.md */, 985904081CDB0AA700275E4A /* Sources */, 985904141CDB0AA700275E4A /* Tests */, 985904071CDB0AA700275E4A /* Products */,