feat: push

This commit is contained in:
scarqin
2024-12-18 17:11:43 +08:00
parent 89a392b749
commit f283cbbcca
3 changed files with 30 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
npm test
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# 获取当前分支名
BRANCH=$(git rev-parse --abbrev-ref HEAD)
# 如果是从 feature 分支推送
if [[ $BRANCH == feature/* || $BRANCH == fix/* ]]; then
# 获取远程仓库列表
REMOTES=$(git remote)
# 检查是否存在 gitlab 和 github 远程仓库
if echo "$REMOTES" | grep -q "gitlab"; then
echo "Pushing to GitLab..."
git push gitlab $BRANCH
fi
# 只有在明确要求时才推送到 GitHub
if [[ "$1" == "--with-github" ]]; then
if echo "$REMOTES" | grep -q "github"; then
echo "Pushing to GitHub..."
git push github $BRANCH
fi
fi
fi
+4 -1
View File
@@ -13,7 +13,9 @@
"serve:remotes": "lerna run serve --scope=remote --parallel",
"dev": "lerna run dev --scope=core --stream",
"stop": "kill-port --port 5000",
"scan": "i18next-scanner --config i18next-scanner.config.js"
"scan": "i18next-scanner --config i18next-scanner.config.js",
"prepare": "husky",
"push:all": "git push && git push --with-github"
},
"keywords": [],
"author": "",
@@ -68,6 +70,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"file-saver": "^2.0.5",
"husky": "^9.1.7",
"i18next-scanner": "^4.5.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",