-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'npm-publish' into 'main'
merge request after publish See merge request changying/platform/xteriosdk-web!8
- Loading branch information
Showing
5 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
set - e | ||
|
||
data=$(<sensitive.txt) | ||
gh_token=$(echo "$data" | grep "^gh_token=" | cut -d'=' -f2) | ||
gl_token=$(echo "$data" | grep "^gl_token=" | cut -d'=' -f2) | ||
echo "gh_token=$gh_token" | ||
echo "gl_token=$gl_token" | ||
|
||
# https://github.com/chenwei0922/xterio-sdk/ | ||
# github | ||
# githubUrl="https://api.github.com" | ||
# owner="chenwei0922" | ||
# repo="xterio-sdk" | ||
# accessToken=$gh_token | ||
# data='{ | ||
# "title": "merge request after publish", | ||
# "head": "npm-publish", | ||
# "base": "main" | ||
# }' | ||
# response=$(curl -X POST -H "Authorization: token $accessToken" -d "$data" "$githubUrl/repos/$owner/$repo/pulls") | ||
# url=$(python3 -c "import json,sys;obj=json.loads(sys.argv[1]);print(obj['html_url'])" "$response") | ||
# {"url":"https://api.github.com/repos/chenwei0922/xterio-sdk/pulls/3", ...} | ||
|
||
# gitlab | ||
gitlabUrl="https://gitlab.itlibecc.com/api/v4" | ||
projectID="70" | ||
accessToken=$gl_token | ||
title="merge request after publish" | ||
sourceBranch="npm-publish" | ||
targetBranch="main" | ||
|
||
response=$(curl -X POST -H "PRIVATE-TOKEN: $accessToken" -d "source_branch=$sourceBranch" -d "target_branch=$targetBranch" -d "title=$title" "$gitlabUrl/projects/70/merge_requests") | ||
url=$(python3 -c "import json,sys;obj=json.loads(sys.argv[1]);print(obj['web_url'])" "$response") | ||
# {"web_url":"https://gitlab.itlibecc.com/changying/platform/xteriosdk-web/-/merge_requests/7", ...} | ||
|
||
if [ -n "$url" ] ; then | ||
echo "[mr] Pull request created success.✅" | ||
echo "[mr] The detail is: $url" | ||
else | ||
echo "[mr] Pull request created failure.❌" | ||
echo "$response" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,17 @@ set -e | |
pkgName=$1 | ||
version=$2 | ||
# [11,22,33] => 11,22,33 => (11 22 33) | ||
# 将传入的逗号分隔的字符串转换为数组 | ||
result=($(echo $3 | tr ',' ' ')) | ||
# 将传入的逗号分隔的字符串转换为数组, tr可理解成replace,适合简单分割 | ||
# result=($(echo $3 | tr ',' ' ')) | ||
IFS=',' read -ra result <<< "$3" | ||
|
||
msg="" | ||
for item in "${result[@]}" | ||
do | ||
msg="$msg- $item"$'\n' | ||
done | ||
# echo "msg=$msg" | ||
# exit | ||
|
||
data=$(<sensitive.txt) | ||
gh_token=$(echo "$data" | grep "^gh_token=" | cut -d'=' -f2) | ||
|
@@ -26,12 +35,6 @@ elif [ $pkgName == "wallet" ]; then | |
rsync -av --exclude='node_modules' ../examples/example-wallet-react "../$prd" | ||
fi | ||
|
||
msg="" | ||
for item in "${result[@]}" | ||
do | ||
msg="$msg- $item"$'\n' | ||
done | ||
|
||
cd ../ | ||
zip -r "${prd}-${version}.zip" "$prd" -x "$prd/dist/*" "$prd/coverage/*" "$prd/node_modules/*" | ||
|
||
|
@@ -57,6 +60,11 @@ gh repo set-default https://github.com/XterioTech/XterioSDK-Web | |
# 创建一个发布 | ||
gh release create "$VERSION" --title "$TITLE" --notes "$MESSAGE" "${prd}-${version}.zip#${prd} (zip) " | ||
|
||
# 发布特定目录到特定分支 | ||
branch=release/$pkgName/$version | ||
git subtree split -P "$prd" -b "$branch" | ||
git push [email protected]:XterioTech/XterioSDK-Web.git "$branch" | ||
|
||
# 上传构建文件或者源代码文件 | ||
# gh release upload $VERSION a.zip | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters