mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-17 04:31:18 +08:00
0784ebc8e4
* fix: enhance slugify function to handle markdown links * chore: replace conventional-changelog with standard-version for changelog generation
55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
set -e
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo "Enter new version: "
|
|
read VERSION
|
|
else
|
|
VERSION=$1
|
|
fi
|
|
|
|
RELEASE_TAG=${RELEASE_TAG:-""}
|
|
|
|
if [[ -n "$RELEASE_TAG" && "$VERSION" != *"$RELEASE_TAG"* ]]; then
|
|
RELEASE_MSG="$VERSION ($RELEASE_TAG)"
|
|
else
|
|
RELEASE_MSG="$VERSION"
|
|
fi
|
|
|
|
read -p "Releasing $VERSION $RELEASE_TAG - are you sure? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Releasing $VERSION ..."
|
|
|
|
# Update version (don't commit or tag yet)
|
|
npm --no-git-tag-version version "$VERSION"
|
|
|
|
# Build and test
|
|
npm run build
|
|
npm run test:update:snapshot
|
|
npm run test
|
|
git stash
|
|
npm run build:v4 # builds legacy v4 lib/ and themes/ folders for backwards compat while people transition to v5.
|
|
git stash pop
|
|
|
|
# Changelog
|
|
npx standard-version --skip.bump --skip.commit --skip.tag
|
|
|
|
# Commit all changes
|
|
git add -A
|
|
git commit -m "[release] $RELEASE_MSG"
|
|
|
|
# Tag and push
|
|
git tag "v$VERSION"
|
|
git push origin "v$VERSION"
|
|
git push
|
|
|
|
# Publish to npm
|
|
if [[ -z $RELEASE_TAG ]]; then
|
|
npm publish
|
|
else
|
|
npm publish --tag "$RELEASE_TAG"
|
|
fi
|
|
|
|
npm run clean:v4 # clean up legacy v4 build files
|
|
fi
|