Skip to content

Commit

Permalink
Release script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jason0x43 committed Apr 1, 2016
1 parent f039a78 commit f27adbf
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions support/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fi

ROOT_DIR=$(cd $(dirname $0) && cd .. && pwd)
BUILD_DIR="$ROOT_DIR/build"
BUILD_REMOTE="_build_"

if [ -d "$BUILD_DIR" ]; then
echo "Existing build directory detected at $BUILD_DIR"
Expand All @@ -53,7 +54,8 @@ fi

cd "$ROOT_DIR"
mkdir "$BUILD_DIR"
git clone --recursive [email protected]:theintern/intern.git "$BUILD_DIR"
git clone --recursive . "$BUILD_DIR"
git remote add "$BUILD_REMOTE" "$BUILD_DIR"

cd "$BUILD_DIR"

Expand Down Expand Up @@ -119,7 +121,7 @@ if [ $(git tag |grep -c "^$TAG_VERSION$") -gt 0 ]; then
fi

# Set the package version to release version
sed -i -e "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" package.json
sed -i '' -e "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" package.json

# Fix the Git-based dependencies to specific commit IDs
echo -e "\nFixing dependency commits...\n"
Expand All @@ -138,7 +140,7 @@ for DEP in dojo; do
rm -rf "$BUILD_DIR/.dep"
DEP_URL=$(echo $DEP_URL |sed -e 's/[\/&]/\\&/g')
echo -e "\nFixing dependency $DEP to commit $COMMIT...\n"
sed -i -e "s/\(\"$DEP\":\) \"[^\"]*\"/\1 \"$DEP_URL\/archive\/$COMMIT.tar.gz\"/" package.json
sed -i '' -e "s/\(\"$DEP\":\) \"[^\"]*\"/\1 \"$DEP_URL\/archive\/$COMMIT.tar.gz\"/" package.json
fi
fi
done
Expand All @@ -152,7 +154,7 @@ git checkout HEAD^ package.json
git reset package.json

# Set the package version to next pre-release version
sed -i -e "s/\"version\": \"[^\"]*\"/\"version\": \"$PRE_VERSION\"/" package.json
sed -i '' -e "s/\"version\": \"[^\"]*\"/\"version\": \"$PRE_VERSION\"/" package.json

# Commit the pre-release to Git
git commit -m "Updating source version to $PRE_VERSION" package.json
Expand All @@ -163,7 +165,7 @@ if [ "$MAKE_BRANCH" != "" ]; then
git checkout -b $MAKE_BRANCH $TAG_VERSION

# Set the package version to the next patch pre-release version
sed -i -e "s/\"version\": \"[^\"]*\"/\"version\": \"$BRANCH_VERSION\"/" package.json
sed -i '' -e "s/\"version\": \"[^\"]*\"/\"version\": \"$BRANCH_VERSION\"/" package.json

# Commit the pre-release to Git
git commit -m "Updating source version to $BRANCH_VERSION" package.json
Expand All @@ -172,28 +174,30 @@ if [ "$MAKE_BRANCH" != "" ]; then
PUSH_BRANCHES="$PUSH_BRANCHES $MAKE_BRANCH"
fi

git checkout $RELEASE_TAG

echo -e "\nDone!\n"

echo "Please confirm packaging success, then press 'y', ENTER to publish to"
echo "npm $NPM_TAG, push tags $RELEASE_TAG, and upload,"
echo "or any other key to bail."
echo "Please confirm packaging success, then press 'y', ENTER to publish to npm "
echo "$NPM_TAG, push tags $RELEASE_TAG, and upload, or any other key to bail."
read -p "> "

if [ "$REPLY" != "y" ]; then
echo "Aborted."
exit 0
fi

for BRANCH in $PUSH_BRANCHES; do
git push origin $BRANCH
done
echo npm publish --tag $NPM_TAG

git push origin --tags
cd "$ROOT_DIR"
git fetch "$BUILD_DIR" --tags

git checkout $RELEASE_TAG
npm publish --tag $NPM_TAG
for BRANCH in $PUSH_BRANCHES; do
echo git checkout $BRANCH
echo git pull "$BUILD_REMOTE"
done

cd "$ROOT_DIR"
rm -rf "$BUILD_DIR"
echo git remote remove "$BUILD_REMOTE"

echo -e "\nAll done! Yay!"

0 comments on commit f27adbf

Please sign in to comment.