forked from Swinject/SwinjectStoryboard
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
69 lines (64 loc) · 2.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 --tags --abbrev=0)
ifndef UPSTREAM
UPSTREAM=upstream
endif
.PHONY: push-to-upstream
push-to-upstream:
git push $(UPSTREAM) $(shell git rev-parse --abbrev-ref HEAD)
git push $(UPSTREAM) $(VERSION_TAG)
#
# Make a release for Carthage.
#
VERSION_TAG=$(shell git describe --tags --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 $(VERSION_TAG) --draft --title v$(VERSION_TAG) --notes ""
@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