|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
# go to root of repository
|
|
|
|
|
cd $(git rev-parse --show-toplevel)
|
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
|
|
|
|
|
|
# get commit id
|
|
|
|
|
ORIG_COMMIT="$(git rev-parse HEAD)"
|
|
|
|
@ -20,22 +20,22 @@ PKG_VERSION="$(node -e '
|
|
|
|
|
')"
|
|
|
|
|
|
|
|
|
|
# determine current branch name, and create new temporary branch
|
|
|
|
|
ORIG_BRANCH=$(git symbolic-ref --short HEAD)
|
|
|
|
|
TEMP_BRANCH=RELEASE_${PKG_VERSION}_$(date +'%Y%m%d%H%M%S')
|
|
|
|
|
git checkout --orphan=${TEMP_BRANCH}
|
|
|
|
|
ORIG_BRANCH="$(git symbolic-ref --short HEAD)"
|
|
|
|
|
TEMP_BRANCH="RELEASE_${PKG_VERSION}_$(date +'%Y%m%d%H%M%S')"
|
|
|
|
|
git checkout --orphan="${TEMP_BRANCH}"
|
|
|
|
|
git rm --cached -rf .
|
|
|
|
|
|
|
|
|
|
# track the files that should be included in the published package
|
|
|
|
|
PKG_TAR="$(npm pack | tail -n 1)"
|
|
|
|
|
git add -f $(tar tf ${PKG_TAR} | cut -c 9-)
|
|
|
|
|
rm ${PKG_TAR}
|
|
|
|
|
tar tf "${PKG_TAR}" | cut -c 9- | xargs -d '\n' git add -f
|
|
|
|
|
rm "${PKG_TAR}"
|
|
|
|
|
|
|
|
|
|
# commit and tag
|
|
|
|
|
git commit -m "v${PKG_VERSION} @ ${ORIG_COMMIT}"
|
|
|
|
|
git tag v${PKG_VERSION} -am "v${PKG_VERSION} @ ${ORIG_COMMIT}"
|
|
|
|
|
git tag "v${PKG_VERSION}" -am "v${PKG_VERSION} @ ${ORIG_COMMIT}"
|
|
|
|
|
|
|
|
|
|
# return to original state
|
|
|
|
|
git reset ${ORIG_BRANCH}
|
|
|
|
|
git checkout ${ORIG_BRANCH}
|
|
|
|
|
git reset "${ORIG_BRANCH}"
|
|
|
|
|
git checkout "${ORIG_BRANCH}"
|
|
|
|
|
cat <<< "${ORIG_PKG}" > package.json
|
|
|
|
|
git branch -D ${TEMP_BRANCH}
|
|
|
|
|
git branch -D "${TEMP_BRANCH}"
|
|
|
|
|