Skip to content

Commit d0d8101

Browse files
committed
Updated release script to allow entering release notes
Change branch to master
1 parent 4563caa commit d0d8101

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

script/release

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env sh
2-
REMOTE_BRANCH=swift-2.0
2+
REMOTE_BRANCH=master
33
POD_NAME=Nimble
44
PODSPEC=Nimble.podspec
55
GITHUB_TAGS_URL=https://github.com/Quick/Nimble/tags
@@ -65,7 +65,7 @@ if [ $? -ne 0 ]; then
6565
fi
6666

6767
echo " > Is this version ($VERSION) unique?"
68-
git describe --exact-match "$VERSION_TAG" 2>&1 > /dev/null
68+
git describe --exact-match "$VERSION_TAG" > /dev/null 2>&1
6969
if [ $? -eq 0 ]; then
7070
if [ -z "$FORCE_TAG" ]; then
7171
die "This tag ($VERSION) already exists. Aborting. Append '-f' to override"
@@ -77,7 +77,23 @@ else
7777
fi
7878

7979
if [ ! -f "$RELEASE_NOTES" ]; then
80-
die "Failed to find $RELEASE_NOTES. Aborting."
80+
echo " > Failed to find $RELEASE_NOTES. Prompting editor"
81+
RELEASE_NOTES=.release-changes
82+
LATEST_TAG=`git for-each-ref refs/tags --sort=-refname --format="%(refname:short)" | grep 'v\\?\\d\\+\\.\\d\\+\\.\\d\\+' | ruby -e 'puts STDIN.read.split("\n").sort { |a,b| a.gsub("v", "").split(".").map(&:to_i) <=> b.gsub("v", "").split(".").map(&:to_i) }.last'`
83+
echo " > Latest tag ${LATEST_TAG}"
84+
echo "Nimble v$VERSION" > $RELEASE_NOTES
85+
echo "================" >> $RELEASE_NOTES
86+
echo >> $RELEASE_NOTES
87+
echo "# Changelog from ${LATEST_TAG}..HEAD" >> $RELEASE_NOTES
88+
git log ${LATEST_TAG}..HEAD | sed -e 's/^/# /' >> $RELEASE_NOTES
89+
$EDITOR $RELEASE_NOTES
90+
diff -q $RELEASE_NOTES ${RELEASE_NOTES}.backup > /dev/null 2>&1
91+
STATUS=$?
92+
rm ${RELEASE_NOTES}.backup
93+
if [ $STATUS -eq 0 ]; then
94+
rm $RELEASE_NOTES
95+
die "No changes in release notes file. Aborting."
96+
fi
8197
fi
8298
echo " > Release notes: $RELEASE_NOTES"
8399

@@ -128,7 +144,8 @@ $CARTHAGE build --no-skip-current || die "Failed to build framework for carthage
128144

129145
echo "-> Setting podspec version"
130146
cat "$PODSPEC" | grep 's.version' | grep -q "\"$VERSION\""
131-
if [ $? -eq 0 ]; then
147+
SET_PODSPEC_VERSION=$?
148+
if [ $SET_PODSPEC_VERSION -eq 0 ]; then
132149
echo " > Podspec already set to $VERSION. Skipping."
133150
else
134151
sed -i.backup "s/s.version *= *\".*\"/s.version = \"$VERSION\"/g" "$PODSPEC" || {
@@ -138,8 +155,6 @@ else
138155

139156
git add Nimble.podspec || { restore_podspec; die "Failed to add Nimble.podspec to INDEX"; }
140157
git commit -m "Bumping version to $VERSION" || { restore_podspec; die "Failed to push updated version: $VERSION"; }
141-
git push origin "$REMOTE_BRANCH" || die "Failed to push to origin"
142-
echo " > Pushed version to origin"
143158
fi
144159

145160
if [ -z "$FORCE_TAG" ]; then
@@ -154,6 +169,12 @@ else
154169
git push origin "$VERSION_TAG" -f || die "Failed to push tag '$VERSION_TAG' to origin"
155170
fi
156171

172+
if [ $SET_PODSPEC_VERSION -ne 0 ]; then
173+
rm $RELEASE_NOTES
174+
git push origin "$REMOTE_BRANCH" || die "Failed to push to origin"
175+
echo " > Pushed version to origin"
176+
fi
177+
157178
echo
158179
echo "---------------- Released as $VERSION_TAG ----------------"
159180
echo

0 commit comments

Comments
 (0)