2 Star 0 Fork 0

mirrors_influxdata/flux-lsp-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
release.sh 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
# The purpose of this script is to automate the release process for the Flux LSP CLI.
# Its sole function is to increment the version number in package.json, add a
# tagged commit, push it to GitHub, and cut a release. Pushing the tag to
# github will trigger a CI job that will publish the new release directly to npm.
# There should be minimal changes included in the commit generated by this script,
# and they should be done in the most mechanical way possible.
hub_installed=$(command -v hub)
if [[ ! $hub_installed ]]; then
echo "Please install the hub command line tool before running this script."
echo "https://github.com/github/hub"
exit 1
fi
current_branch=$(git branch --show-current)
if [[ $current_branch != "master" ]]; then
echo "This script should only be run from the master branch. Aborting."
exit 1
fi
git_changes=$(git status -s | wc -l)
if [[ $git_changes != 0 ]]; then
echo "The master branch has been modified."
echo "Please revert the changes or move them to another branch before running this script."
exit 1
fi
git fetch
ahead=$(git status -sb | grep ahead -c)
if [[ $ahead != 0 ]]; then
echo "Your local master branch is ahead of the remote master branch. Exiting."
exit 1
fi
release_type=$1
if [[ $release_type != "patch" && $release_type != "minor" && $release_type != "major" ]]; then
echo "Invalid argument: $release_type"
exit 1
fi
git pull origin master
version=v$(cat package.json| grep -Po -m 1 '\d+\.\d+\.\d+')
npm version $release_type --no-git-tag-version
npm install
new_version=v$(cat package.json | grep -Po -m 1 '\d+\.\d+\.\d+')
echo "Cutting $release_type release"
echo "$version -> $new_version"
git add .
git commit -m "build(release): Release $new_version"
git tag -a $new_version HEAD -m "Release $new_verion"
git push origin master --follow-tags
hub release create $new_version -m "Release $new_version" -e
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_influxdata/flux-lsp-cli.git
git@gitee.com:mirrors_influxdata/flux-lsp-cli.git
mirrors_influxdata
flux-lsp-cli
flux-lsp-cli
master

搜索帮助