Skip to content

Commit

Permalink
Merge pull request #160 from mpdifran/makefile-for-release
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdifran authored Jul 5, 2021
2 parents 299d68d + 7e3624e commit d726000
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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=<version#> set-new-version (e.g. make VERSION=1.2.3 set-new-version)'
@echo ' $$ make [UPSTREAM=<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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions SwinjectStoryboard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
CDA864B11EA9F28E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = "<group>"; };
CDA864B41EA9F29E00293FEC /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/tvOS/Nimble.framework; sourceTree = "<group>"; };
CDA864B51EA9F29E00293FEC /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/tvOS/Quick.framework; sourceTree = "<group>"; };
FF0BC8F226920979000E4FE6 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
FF492DA21EDA490F0081A4A7 /* SwinjectStoryboard+SetUp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SwinjectStoryboard+SetUp.m"; sourceTree = "<group>"; };
FF492DAF1EDA65D90081A4A7 /* NSStoryboard+Swizzling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSStoryboard+Swizzling.h"; sourceTree = "<group>"; };
FF492DB01EDA65D90081A4A7 /* NSStoryboard+Swizzling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSStoryboard+Swizzling.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -431,6 +432,7 @@
985903FC1CDB0AA700275E4A = {
isa = PBXGroup;
children = (
FF0BC8F226920979000E4FE6 /* README.md */,
985904081CDB0AA700275E4A /* Sources */,
985904141CDB0AA700275E4A /* Tests */,
985904071CDB0AA700275E4A /* Products */,
Expand Down

0 comments on commit d726000

Please sign in to comment.