Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard-package-script
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
mycard-package-script
Commits
e90b8b63
Commit
e90b8b63
authored
Aug 25, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work
parent
68761f0f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
26 deletions
+90
-26
.gitignore
.gitignore
+1
-0
README.md
README.md
+26
-4
get-builds.sh
get-builds.sh
+0
-5
index.sh
index.sh
+5
-1
pack.sh
pack.sh
+0
-10
src/login.sh
src/login.sh
+7
-1
src/pack-utility.sh
src/pack-utility.sh
+51
-5
No files found.
.gitignore
View file @
e90b8b63
/pool
/pool
/jsons
README.md
View file @
e90b8b63
...
@@ -14,22 +14,44 @@
...
@@ -14,22 +14,44 @@
## 如何使用
## 如何使用
### 查看 APP JSON 信息
```
bash
./index.sh getAppJson <APP 名称>
```
同时会把文件保存在
`./jsons/<APP 名称>.json`
下。
### 更新 APP JSON 信息
```
bash
./index.sh uploadAppsJson <APP 名称> <JSON 文件路径>
```
文件默认从
`./jsons/<APP 名称>.json`
获取。
### 更新包信息
```
bash
./index.sh getAppBuilds <APP 名称>
```
### 查看包信息
### 查看包信息
```
bash
```
bash
./
get-builds.sh
<APP 名称>
./
index.sh getAppJson
<APP 名称>
```
```
### 打包
### 打包
```
bash
```
bash
./
pack.sh
<APP 名称> <APP 路径> <APP 版本号>
./
index.sh makeBuild
<APP 名称> <APP 路径> <APP 版本号>
```
```
### 删除
版本
### 删除
打包
```
bash
```
bash
./
delete-build.sh
<APP 名称> <APP 版本号>
./
index.sh deleteBuild
<APP 名称> <APP 版本号>
```
```
## 变量
## 变量
...
...
get-builds.sh
deleted
100755 → 0
View file @
68761f0f
#!/bin/bash
# set -o errexit
source
./src/pack-utility.sh
getAppBuilds
"
$@
"
delete-build
.sh
→
index
.sh
View file @
e90b8b63
...
@@ -2,4 +2,8 @@
...
@@ -2,4 +2,8 @@
# set -o errexit
# set -o errexit
source
./src/pack-utility.sh
source
./src/pack-utility.sh
deleteBuild
"
$@
"
if
[[
-n
"
$1
"
]]
;
then
"
$@
"
else
help
fi
pack.sh
deleted
100755 → 0
View file @
68761f0f
#!/bin/bash
# set -o errexit
source
./src/pack-utility.sh
appName
=
"
$1
"
appPath
=
"
$2
"
if
[[
-z
"
$appPath
"
]]
;
then
appPath
=
"pool/
$appName
"
fi
makeBuild
"
$appName
"
"
$appPath
"
src/login.sh
View file @
e90b8b63
apiRoot
=
https://sapi.moecube.com:444
apiRoot
=
https://sapi.moecube.com:444
loginInfo
=
$(
curl
-sL
-X
POST
$apiRoot
/accounts/signin
-d
account
=
$username
-d
password
=
$password
)
loginInfo
=
$(
curl
-sL
-X
POST
$apiRoot
/accounts/signin
-d
account
=
$username
-d
password
=
$password
)
token
=
$(
echo
$loginInfo
| jq
'.token'
|
sed
's/"//g'
)
loginExitCode
=
"
$?
"
loginErrorMessage
=
$(
echo
"
$loginInfo
"
| jq
'.message'
|
sed
's/"//g'
)
if
[[
"
$loginExitCode
"
-gt
0
]]
;
then
echo
"Login failed:
$loginErrorMessage
"
exit
1
fi
token
=
$(
echo
"
$loginInfo
"
| jq
'.token'
|
sed
's/"//g'
)
header
=
"Authorization:
$token
"
header
=
"Authorization:
$token
"
src/pack-utility.sh
View file @
e90b8b63
set
-o
errexit
apiRoot
=
https://sapi.moecube.com:444
apiRoot
=
https://sapi.moecube.com:444
source
./src/login.sh
source
./src/login.sh
source
./src/prefix.sh
source
./src/prefix.sh
handleErrorMessage
()
{
rawJsonInput
=
"
$1
"
successInfo
=
$(
echo
"
$rawJsonInput
"
| jq
'.success'
)
statusCode
=
$(
echo
"
$rawJsonInput
"
| jq
'.statusCode'
)
if
[[
"
$successInfo
"
!=
"true"
]]
;
then
failMessage
=
$(
echo
"
$rawJsonInput
"
| jq
'.success'
)
echo
"
$rawJsonInput
"
exit
1
fi
}
makeBuild
()
{
makeBuild
()
{
appName
=
"
$1
"
appName
=
"
$1
"
appPath
=
"
$2
"
appPath
=
"
$2
"
if
[[
-z
"
$appPath
"
]]
;
then
appPath
=
"pool/
$appName
"
fi
echo
"Packaging
$appName
from
$appPath
"
echo
"Packaging
$appName
from
$appPath
"
if
[[
-z
"
$appVersion
"
]]
;
then
if
[[
-z
"
$appVersion
"
]]
;
then
appVersion
=
"
$3
"
appVersion
=
"
$3
"
...
@@ -19,9 +36,9 @@ makeBuild() {
...
@@ -19,9 +36,9 @@ makeBuild() {
echo
"Version:
$appVersion
"
echo
"Version:
$appVersion
"
currentPath
=
"
$PWD
"
currentPath
=
"
$PWD
"
cd
"
$appPath
"
cd
"
$appPath
"
tar
--zstd
-cvf
-
*
| curl
-sL
-H
"
$header
"
-X
POST
"
$apiRoot
/release/api/build/
$appName
/
${
appVersion
}${
suffix
}
"
-F
file
=
@- | jq
result
=
$(
tar
--zstd
-cvf
-
*
| curl
-sL
-H
"
$header
"
-X
POST
"
$apiRoot
/release/api/build/
$appName
/
${
appVersion
}${
suffix
}
"
-F
file
=
@-
)
echo
"Finished.
"
handleErrorMessage
"
$result
"
cd
"
$currentPath
"
echo
"
$result
"
| jq
}
}
deleteBuild
()
{
deleteBuild
()
{
...
@@ -31,10 +48,39 @@ deleteBuild() {
...
@@ -31,10 +48,39 @@ deleteBuild() {
fi
fi
echo
"Removing build
$appName
"
echo
"Removing build
$appName
"
echo
"Version:
$appVersion
"
echo
"Version:
$appVersion
"
curl
-sL
-H
"
$header
"
-X
DELETE
"
$apiRoot
/release/api/build/
$appName
/
${
appVersion
}${
suffix
}
"
result
=
$(
curl
-sL
-H
"
$header
"
-X
DELETE
"
$apiRoot
/release/api/build/
$appName
/
${
appVersion
}${
suffix
}
"
)
handleErrorMessage
"
$result
"
echo
"
$result
"
| jq
}
getAppInfoRaw
()
{
appName
=
"
$1
"
result
=
$(
curl
-sL
-H
"
$header
"
"
$apiRoot
/release/api/app?id=
$appName
"
)
handleErrorMessage
"
$result
"
echo
"
$result
"
}
}
getAppBuilds
()
{
getAppBuilds
()
{
getAppInfoRaw
"
$@
"
| jq
".data[0].depots"
}
getAppJson
()
{
appName
=
"
$1
"
getAppInfoRaw
"
$@
"
| jq
".data[0].appData"
|
tee
"./jsons/
$appName
.json"
}
uploadAppsJson
()
{
appName
=
"
$1
"
appName
=
"
$1
"
curl
-sL
-H
"
$header
"
"
$apiRoot
/release/api/app?id=
$appName
"
| jq
".data[0].depots"
jsonPath
=
"
$2
"
if
[[
-z
"
$jsonPath
"
]]
;
then
jsonPath
=
"./jsons/
$appName
.json"
fi
echo
"Updating
$appName
with info from
$jsonPath
."
result
=
$(
curl
-sL
-H
"
$header
"
-H
"Content-Type: application/json"
-d
"@
$jsonPath
"
-X
POST
"
$apiRoot
/release/api/app"
)
handleErrorMessage
"
$result
"
echo
"
$result
"
| jq
}
help
()
{
cat
./README.md
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment